linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erez Zadok <ezk@cs.sunysb.edu>
To: jjohansen@suse.de
Cc: linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	Andreas Gruenbacher <agruen@suse.de>
Subject: Re: [RFD 1/4] Pass no useless nameidata to the create, lookup, and permission IOPs
Date: Tue, 26 Jun 2007 20:11:41 -0400	[thread overview]
Message-ID: <200706270011.l5R0BfPO011424@agora.fsl.cs.sunysb.edu> (raw)
In-Reply-To: Your message of "Tue, 26 Jun 2007 16:15:11 PDT." <20070626231541.697783295@suse.de>

In message <20070626231541.697783295@suse.de>, jjohansen@suse.de writes:
> The create, lookup, and permission inode operations are all passed a
> full nameidata.  This is unfortunate because in nfsd and the mqueue
> filesystem, we must instantiate a struct nameidata but cannot provide
> all of the same information that a regular lookup would provide.  The
> unused fields take up space on the stack, but more importantly, it is
> not obvious which fields have meaningful values and which don't, and so
> things might easily break.
> 
> This patch introduces struct nameidata2 with only the fields that make
> sense independent of an actual lookup, and uses that struct in those
> places where a full nameidat is not needed.

I agree w/ Trond that a better name is needed other than 'nameidata2',
esp. for something that's a sub-structure (perhaps start it with a '__'?)

These changes would probably help stackable file systems (e.g., eCryptfs and
esp. Unionfs) a lot, b/c stackable f/s often call the lower f/s to lookup
files and such; and in most cases, we just need to pass the intent down, not
the full VFS-level state info.

> +/**
> + * Fields shared between nameidata and nameidata2 -- nameidata2 could
> + * simply be embedded in nameidata, but then the vfs code would become
> + * cluttered with dereferences.
> + */
> +#define __NAMEIDATA2				\
> +	struct dentry	*dentry;		\
> +	struct vfsmount *mnt;			\
> +	unsigned int	flags;			\
> +						\
> +	union {					\
> +		struct open_intent open;	\
> +	} intent;

Perhaps it is also time to put the dentry + mnt into a single struct path?
It's a small change, but it emphasizes that the two items here, dentry+mnt,
really define a single path to be passed around:

#define __NAMEIDATA			\
	struct path path;		\
	unsigned int flags;		\
	...

Of course, you'll have to change instances of nd->dentry to nd->path.dentry
and so on.

Erez.

  reply	other threads:[~2007-06-27  0:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-26 23:15 [RFD 0/4] AppArmor - Don't pass NULL nameidata to vfs_create/lookup/permission IOPs jjohansen
2007-06-26 23:15 ` [RFD 1/4] Pass no useless nameidata to the create, lookup, and permission IOPs jjohansen
2007-06-27  0:11   ` Erez Zadok [this message]
2007-06-30  9:14     ` Christoph Hellwig
2007-06-30  9:13   ` Christoph Hellwig
2007-06-30 16:13     ` Andreas Gruenbacher
2007-06-26 23:15 ` [RFD 2/4] Never pass a NULL nameidata to vfs_create() jjohansen
2007-06-26 23:15 ` [RFD 3/4] Dont use a NULL nameidata in xattr_permission() jjohansen
2007-06-26 23:15 ` [RFD 4/4] Pass nameidata2 to permission() from nfsd_permission() jjohansen
2007-06-26 23:46 ` [RFD 0/4] AppArmor - Don't pass NULL nameidata to vfs_create/lookup/permission IOPs Trond Myklebust
2007-06-27 20:42   ` Andreas Gruenbacher
2007-06-30  9:15   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200706270011.l5R0BfPO011424@agora.fsl.cs.sunysb.edu \
    --to=ezk@cs.sunysb.edu \
    --cc=agruen@suse.de \
    --cc=jjohansen@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).