[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get vfsmount from inode?

Quoting Chris Wright <chris@xxxxxxxxx> on Wed, Jul 30 12:03:
> One way to know that they at least match is to look at the super_block's
> root and compare it against the mountpoint's root for each mountpoint in
> your namespace.  Less than ideal, but it will work.  Then you get to
> decide what to do if there is more than one match ;-)

Something like this?

struct vfsmount *mnt = find_vfsmount(inode->i_sb->s_root);

static struct vfsmount *find_vfsmount(struct dentry *d) {
   struct list_head *list = &current->fs->rootmnt->mnt_list;
   struct list_head *pos;

   list_for_each(pos, list) {
	  struct vfsmount *entry = list_entry(pos, struct vfsmount, mnt_list);
	  if(entry->mnt_root == d)
			return entry;


Does not work (returns NULL), for files NOT on /.  This is under UML if
it makes a difference.  

Am I getting what I want with list_entry?  I am still wrapping my head
around the kernels way of doing linked lists.


Laughter is the closest distance between two people.

Attachment: pgp_WLlkCmS8V.pgp
Description: PGP signature

linux-security-module mailing list

This mailing list archive is a service of Copilotco.