linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Ric Wheeler <rwheeler@redhat.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>,
	Anand Avati <avati@redhat.com>, Brian Foster <bfoster@redhat.com>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	Alexander Viro <aviro@redhat.com>,
	David Howells <dhowells@redhat.com>,
	Eric Paris <eparis@redhat.com>,
	Linux NFS list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] [REPOST] fuse: drop dentry on failed revalidate
Date: Fri, 2 Aug 2013 11:02:25 +0200	[thread overview]
Message-ID: <CAJfpegu1RXAYOGWyuCeckJ8WHfK=3dFc5bm1zsM=1Qt3zcfbsg@mail.gmail.com> (raw)
In-Reply-To: <51FAACD9.8020205@redhat.com>

On Thu, Aug 1, 2013 at 8:45 PM, Ric Wheeler <rwheeler@redhat.com> wrote:
>
> Adding in the NFS list for broader review.
>
> I thought that the issue was primarily in FUSE itself, not seen in practice
> in NFS?

I haven't tested NFS (have but a single notebook here) but AFAICS the
issue of not fuse specific but is inherent in the fact that NFS does
d_drop() on a non-empty directory dentry.  It does check for submounts
*before*, but it doesn't do anything about submounts *after* (or
during) the d_drop().   It's probably not something people complain
about, because they choose mountpoints to be pretty stable points in
the tree that don't get removed or moved around.

Thanks,
Miklos

>>
>> diff --git a/fs/dcache.c b/fs/dcache.c
>> index 87bdb53..5c51217 100644
>> --- a/fs/dcache.c
>> +++ b/fs/dcache.c
>> @@ -1103,6 +1103,34 @@ rename_retry:
>>   }
>>   EXPORT_SYMBOL(have_submounts);
>>   +static bool __has_unlinked_ancestor(struct dentry *dentry)
>> +{
>> +       struct dentry *this;
>> +
>> +       for (this = dentry; !IS_ROOT(this); this = this->d_parent) {
>> +               if (d_unhashed(this))
>> +                       return true;
>> +       }
>> +       return false;
>> +}
>> +
>> +/*
>> + * Called by mount code to check if the mountpoint is reachable (e.g. NFS
>> can
>> + * unhash a directory dentry and then the complete subtree can become
>> + * unreachable).
>> + */
>> +bool has_unlinked_ancestor(struct dentry *dentry)
>> +{
>> +       bool found;
>> +
>> +       /* Need exclusion wrt. have_submounts() */
>> +       write_seqlock(&rename_lock);
>> +       found = __has_unlinked_ancestor(dentry);
>> +       write_sequnlock(&rename_lock);
>> +
>> +       return found;
>> +}
>> +
>>   /*
>>    * Search the dentry child list of the specified parent,
>>    * and move any unused dentries to the end of the unused
>> diff --git a/fs/internal.h b/fs/internal.h
>> index 7c5f01c..d232355 100644
>> --- a/fs/internal.h
>> +++ b/fs/internal.h
>> @@ -126,6 +126,7 @@ extern int invalidate_inodes(struct super_block *,
>> bool);
>>    * dcache.c
>>    */
>>   extern struct dentry *__d_alloc(struct super_block *, const struct qstr
>> *);
>> +extern bool has_unlinked_ancestor(struct dentry *dentry);
>>     /*
>>    * read_write.c
>> diff --git a/fs/namespace.c b/fs/namespace.c
>> index 7b1ca9b..bb92a9c 100644
>> --- a/fs/namespace.c
>> +++ b/fs/namespace.c
>> @@ -634,6 +634,15 @@ static struct mountpoint *new_mountpoint(struct
>> dentry *dentry)
>>         }
>>         dentry->d_flags |= DCACHE_MOUNTED;
>>         spin_unlock(&dentry->d_lock);
>> +
>> +       if (has_unlinked_ancestor(dentry)) {
>> +               spin_lock(&dentry->d_lock);
>> +               dentry->d_flags &= ~DCACHE_MOUNTED;
>> +               spin_unlock(&dentry->d_lock);
>> +               kfree(mp);
>> +               return ERR_PTR(-ENOENT);
>> +       }
>> +
>>         mp->m_dentry = dentry;
>>         mp->m_count = 1;
>>         list_add(&mp->m_hash, chain);
>
>

  reply	other threads:[~2013-08-02  9:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130725055209.GA15621@sh-el5.eng.rdu2.redhat.com>
     [not found] ` <51F13948.3050100@redhat.com>
     [not found]   ` <CAJfpegtpcXz+i-3txRC_NjTsYjXP5S4oJUdGstG+-PWVzazEWQ@mail.gmail.com>
     [not found]     ` <51F81465.9010402@redhat.com>
     [not found]       ` <20130801163940.GA1356@tucsk.piliscsaba.szeredi.hu>
2013-08-01 18:45         ` [PATCH] [REPOST] fuse: drop dentry on failed revalidate Ric Wheeler
2013-08-02  9:02           ` Miklos Szeredi [this message]
2013-08-02 11:43             ` Jeff Layton
2013-08-02 14:30               ` Miklos Szeredi
2013-08-02 16:58                 ` Jeff Layton

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='CAJfpegu1RXAYOGWyuCeckJ8WHfK=3dFc5bm1zsM=1Qt3zcfbsg@mail.gmail.com' \
    --to=miklos@szeredi.hu \
    --cc=Trond.Myklebust@netapp.com \
    --cc=avati@redhat.com \
    --cc=aviro@redhat.com \
    --cc=bfoster@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=eparis@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=rwheeler@redhat.com \
    /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).