Re: Q. Switch open_exec() and sys_uselib() to do_open_filp()

From: Al Viro
Date: Mon May 11 2009 - 02:52:22 EST


On Mon, May 11, 2009 at 02:20:09PM +0900, hooanon05@xxxxxxxxxxx wrote:
>
> Al Viro:
> > Nope. It ended up in nd->intent.open.flags due to path_lookup_open().
>
> Yes.
>
>
> > Then lookup_instantiate_filp() from a filesystem that might care about
> > intents did
> > nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->mnt),
> > nd->intent.open.flags - 1,
> > nd->intent.open.file,
> > open);
> > and nameidata_to_filp() ended up picking nd->intent.open.file.
>
> FS supporting lookup_instantiate_filp() is rare, isn't it?
> Simple grep told me it is called by fuse, nfsv4, cifs, and 9p only.
> In other FS, FMODE_EXEC was dropped since nameidata_to_filp() (from
> open_exec() directly) doesn't pick intent.open.flags up.

The rest of filesystems simply ignore FMODE_EXEC completely, no matter where
it is.

> Anyway, I could confirm that setting FMODE_EXEC to f_flags is intended.
> Thank you for your quick responces.

NOTE: "intended" != "is promised to stay that way". Indeed, this thread is
an excellent demonstration of the reasons for massaging the entire nightmare
into saner shape. The call graph in the current form is an obscenity, the
number of possible codepaths is way too high, thanks to the intents mess and
the paths taken by the data are interesting and hard to trace, to put it
very mildly.

The things *will* change, and final destination of FMODE_EXEC may very well
be among those. The commit in question did the following:
* eliminate two special codepaths
* make FMODE_EXEC treatment consistent (it's always propagated to
f_flags) without functionality changes (filesystems that ignored the intents
are ignoring that bit in f_flags completely anyway).

We might end up changing the treatment of that thing and it might very well
end up in f_mode. However, that would be a separate patch and it's not for
this point in cycle.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/