From: NeilBrown <neilb@suse.com>
To: Oleg Drokin <oleg.drokin@intel.com>,
Greg Kroah-Hartman <greg@kroah.com>,
Andreas Dilger <andreas.dilger@intel.com>
Cc: Lustre Development List <lustre-devel@lists.lustre.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 6/6] staging: lustre: llite: fix incorrect DCACHE_DISCONNECTED test
Date: Wed, 02 Aug 2017 13:06:18 +1000 [thread overview]
Message-ID: <150164317832.13199.6113390117004813683.stgit@noble> (raw)
In-Reply-To: <150164273003.13199.7841976922211510658.stgit@noble>
It is almost always wrong to test DCACHE_DISCONNECTED, except in
"exportfs" code.
The flag tells us that this dentry *might* not be connected to the
root through a chain of d_parent links. Following the d_parent
to an IS_ROOT() dentry *might* find one that is on the s_anon list
rather than s_root.
The code here needs to know if it is safe to call __d_drop(), and
the correct test is "!IS_ROOT(dentry)".
If an dentry IS_ROOT(), then it might be the filesystem root, or it
might be the root of a DCACHE_DISCONNECTED tree, and so be on
the s_anon list. In these two cases it should not be __d_drop()ed.
If !IS_ROOT(), then the dentry is attached to its parent through
d_subdir, and can safely be unhashed.
Signed-off-by: NeilBrown <neilb@suse.com>
---
.../staging/lustre/lustre/llite/llite_internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index cd3311abf999..4854985bf4d3 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -1299,7 +1299,7 @@ static inline void d_lustre_invalidate(struct dentry *dentry, int nested)
* If we unhashed such a dentry, unmount would not be able to find
* it and busy inodes would be reported.
*/
- if (d_count(dentry) == 0 && !(dentry->d_flags & DCACHE_DISCONNECTED))
+ if (d_count(dentry) == 0 && !IS_ROOT(dentry))
__d_drop(dentry);
spin_unlock(&dentry->d_lock);
}
next prev parent reply other threads:[~2017-08-02 3:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-02 3:06 [PATCH 0/6] dcache/namei fixes for lustre NeilBrown
2017-08-02 3:06 ` [PATCH 4/6] staging: lluste: llite: simplify ll_find_alias() NeilBrown
2017-08-02 3:06 ` [PATCH 1/6] staging: lustre: llite: handle DCACHE_PAR_LOOKUP in ll_dcompare NeilBrown
2017-08-02 3:06 ` [PATCH 3/6] staging: lustre: llite: remove directory-specific code from ll_find_alias() NeilBrown
2017-08-02 3:06 ` [PATCH 2/6] staging: lustre: llite: use d_splice_alias for directories NeilBrown
2017-08-02 3:06 ` [PATCH 5/6] staging: lustre: llite: refine ll_find_alias based on d_exact_alias NeilBrown
2017-08-02 3:06 ` NeilBrown [this message]
2017-08-20 2:58 ` [lustre-devel] [PATCH 0/6] dcache/namei fixes for lustre James Simmons
2017-10-20 0:39 ` NeilBrown
2017-10-24 21:50 ` James Simmons
2017-10-24 22:35 ` NeilBrown
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=150164317832.13199.6113390117004813683.stgit@noble \
--to=neilb@suse.com \
--cc=andreas.dilger@intel.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®