All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	"J . Bruce Fields" <bfields@redhat.com>
Subject: Re: [PATCH] exportfs: fix handling of rename race in reconnect_one()
Date: Fri, 7 Feb 2020 08:26:35 +0200	[thread overview]
Message-ID: <CAOQ4uxiTfS_QZN=vrFed=KSFg+CcSqo1ZRqS8_Mx_uvPk3NTPg@mail.gmail.com> (raw)
In-Reply-To: <20200206214518.GB23230@ZenIV.linux.org.uk>

On Thu, Feb 6, 2020 at 11:45 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> On Mon, Jan 27, 2020 at 12:08:00AM +0200, Amir Goldstein wrote:
> > If a disconnected dentry gets looked up and renamed between the
> > call to exportfs_get_name() and lookup_one_len_unlocked(), and if also
> > lookup_one_len_unlocked() returns ERR_PTR(-ENOENT), maybe because old
> > parent was deleted, we return an error, although dentry may be connected.
> >
> > Commit 909e22e05353 ("exportfs: fix 'passing zero to ERR_PTR()'
> > warning") changes this behavior from always returning success,
> > regardless if dentry was reconnected by somoe other task, to always
> > returning a failure.
> >
> > Change the lookup error handling to match that of exportfs_get_name()
> > error handling and return success after getting -ENOENT and verifying
> > that some other task has connected the dentry for us.
>
> It's not that simple, unfortunately.  For one thing, lookup_one_len_unlocked()
> will normally return a negative dentry, not ERR_PTR(-ENOENT).

Which is why this fix is mostly relevant to removed directories.
negative dentry case should be handled correctly by bellow:

        if (tmp != dentry) {


> For another,
> it *can* fail for any number of other reasons (-ENOMEM, for example), without
> anyone having ever looked it up.

Yes, but why should we care to NOT return an error in case of ENOMEM.
The question is are there other errors that we can say "we can let this slide"
as long as the dentry is connected?

I certainly don't mind going to out_reconnected for any error and that includes
the error from exportfs_get_name(). My patch checks only the rename race
case because this is what this function has done so far and this is what the
big comment in out_reconnect is about.

Thanks,
Amir.

  reply	other threads:[~2020-02-07  6:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-26 22:08 [PATCH] exportfs: fix handling of rename race in reconnect_one() Amir Goldstein
2020-01-27  8:04 ` Christoph Hellwig
2020-01-27 17:30 ` J. Bruce Fields
2020-01-27 18:38   ` Amir Goldstein
2020-01-27 21:17     ` J. Bruce Fields
2020-02-06 20:22       ` Amir Goldstein
2020-02-06 21:10         ` J. Bruce Fields
2020-02-06 21:45 ` Al Viro
2020-02-07  6:26   ` Amir Goldstein [this message]
2020-03-13 14:33     ` Amir Goldstein

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='CAOQ4uxiTfS_QZN=vrFed=KSFg+CcSqo1ZRqS8_Mx_uvPk3NTPg@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=bfields@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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.