All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"mszeredi@suse.cz" <mszeredi@suse.cz>,
	Eric Van Hensbergen <ericvh@gmail.com>,
	"M. Mohan Kumar" <mohan@in.ibm.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH 02/11] 9p: fix dentry leak in v9fs_vfs_atomic_open_dotl()
Date: Mon, 16 Sep 2013 20:50:03 +0100	[thread overview]
Message-ID: <20130916195003.GE13318@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAJfpegt3mAKVE7ToZbvPpFQCY1EAZ3tKfn__kfpGz4HeXWr8fw@mail.gmail.com>

On Mon, Sep 16, 2013 at 09:03:25PM +0200, Miklos Szeredi wrote:
> On Mon, Sep 16, 2013 at 8:19 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> > On Mon, Sep 16, 2013 at 02:51:56PM +0200, Miklos Szeredi wrote:
> >> From: Miklos Szeredi <mszeredi@suse.cz>
> >>
> >> commit b6f4bee02f "fs/9p: Fix atomic_open" fixed the O_EXCL behavior, but
> >> results in a dentry leak if v9fs_vfs_lookup() returns non-NULL.
> >
> > Frankly, I would prefer to deal with that in fs/namei.c:atomic_open()
> > instead.  I.e. let it call finish_no_open() as it used to do and
> > turn
> >                 if (create_error && dentry->d_inode == NULL) {
> >                         error = create_error;
> >                         goto out;
> >                 }
> > in fs/namei.c:atomic_open() into
> >                 if (!dentry->d_inode) {
> >                         if (create_error) {
> >                                 error = create_error;
> >                                 goto out;
> >                         }
> >                 } else if ((open_flag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) {
> >                         error = -EEXIST;
> >                         goto out;
> >                 }
> >
> > rather than try to deal with that crap in each instance of ->atomic_open()...
> > Objections?
> 
> ->atomic_open() could be any one of
> 
>  lookup
>  lookup+create
>  lookup+create+open
> 
> If it's the second one then the above is wrong.  Sure, we could check
> FILE_CREATED as well, and if file wasn't created yet dentry is
> positive then we return EEXIST.  But for that to be correct we need
> the last patch in the series, preventing FILE_CREATED from being set
> unconditionally.

You mean, lookup + create + return finish_no_open()?  Does anything actually
do that?  I agree that we want your "deal with setting FILE_CREATED in
filesystems", BTW, and I'm fine with putting it in front of the rest of
the queue.

I would definitely prefer EEXIST logics dealt with in fs/namei.c - if nothing
else, it had been done wrong in too many instances...

  reply	other threads:[~2013-09-16 19:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16 12:51 [PATCH 00/11] atomic open related fixes Miklos Szeredi
2013-09-16 12:51 ` [PATCH 01/11] vfs: improve i_op->atomic_open() documentation Miklos Szeredi
2013-09-16 12:51 ` [PATCH 02/11] 9p: fix dentry leak in v9fs_vfs_atomic_open_dotl() Miklos Szeredi
2013-09-16 18:19   ` Al Viro
2013-09-16 19:03     ` Miklos Szeredi
2013-09-16 19:50       ` Al Viro [this message]
2013-09-16 20:09         ` Miklos Szeredi
2013-09-16 22:02           ` Al Viro
2013-09-16 23:28             ` Al Viro
2013-09-17 10:16               ` Miklos Szeredi
2013-09-17 11:44                 ` Al Viro
2013-09-17 15:36                   ` Miklos Szeredi
2013-09-17 21:23                     ` Al Viro
2013-09-18  8:55                       ` Miklos Szeredi
2013-09-16 12:51 ` [PATCH 03/11] 9p: fix O_EXCL in v9fs_vfs_atomic_open() Miklos Szeredi
2013-09-16 12:51 ` [PATCH 04/11] fuse: fix O_EXCL in fuse_atomic_open() Miklos Szeredi
2013-09-16 12:51 ` [PATCH 05/11] cifs: fix filp leak in cifs_atomic_open() Miklos Szeredi
2013-09-18 15:19   ` Steve French
2013-09-18 15:22     ` Al Viro
2013-09-16 12:52 ` [PATCH 06/11] gfs2: d_splice_alias() cant return error Miklos Szeredi
2013-09-16 13:17   ` Steven Whitehouse
2013-09-16 13:35     ` Miklos Szeredi
2013-09-16 13:56       ` Steven Whitehouse
2013-09-16 12:52 ` [PATCH 07/11] gfs2: pass correct dentry to finish_open() in __gfs2_lookup() Miklos Szeredi
2013-09-16 13:13   ` Steven Whitehouse
2013-09-16 13:34     ` Miklos Szeredi
2013-09-16 13:54       ` Steven Whitehouse
2013-09-16 12:52 ` [PATCH 08/11] gfs2: fix dentry leaks Miklos Szeredi
2013-09-16 12:52 ` [PATCH 09/11] gfs2: set FILE_CREATED Miklos Szeredi
2013-09-16 13:27   ` Steven Whitehouse
2013-09-16 12:52 ` [PATCH 10/11] nfs: " Miklos Szeredi
2013-09-16 12:52 ` [PATCH 11/11] vfs: don't set FILE_CREATED before calling ->atomic_open() Miklos Szeredi

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=20130916195003.GE13318@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=ericvh@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mohan@in.ibm.com \
    --cc=mszeredi@suse.cz \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.