Re: [RFC] atomic open(..., O_CREAT | ...)

From: Miklos Szeredi
Date: Tue Aug 09 2005 - 16:19:58 EST


> Really?
>
> static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
> {
> .....
> if (path_walk(name, nd) == 0) {
> if (nd->dentry->d_inode) {
> dput(old_dentry);
> mntput(old_mnt);
> return 1;
> }
> path_release(nd);
> }
> nd->dentry = old_dentry;
> nd->mnt = old_mnt;
> nd->last = last;
> nd->last_type = last_type;
> }
> return 1;
> }

I see what you are getting at. But notice, that every (relevant)
field of nameidata is reinitialized, except nd->flags, which is
_obviously_ not changed by either path_walk() or path_release().

So your argument doesn't hold.

You basically argue, that intent.open.file must be zeroed, because
someone might call path_release_open_intent() twice, which very
obviously does not make any sense, unless it does some magic like the
above (which it should not), in which case it might as well be aware,
that it has to save/restore the intent.open.file field as well.

> Currently, yes. The only caller of open_namei() is filp_open(). That was
> not always the case previously.
>
> If we think it will never be the case in the future, then there is an
> argument for merging the two and/or making open_namei() and inlined
> function.

Yes, that would make sense.

Miklos
-
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/