Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1690820

[PATCH 02/12] staging: lustre: llite: fix incorrect DCACHE_DISCONNECTED test

From NeilBrown <neilb@suse.com>
Newsgroups linux.kernel
Subject [PATCH 02/12] staging: lustre: llite: fix incorrect DCACHE_DISCONNECTED test
Date 2017-07-19 01:30 +0200
Message-ID <u4K6e-ns-25@gated-at.bofh.it> (permalink)
References <u4K6d-ns-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 need to know if it is safe to call __d_drop(), and
the correct test is "!IS_ROOT(dentry)".
If a 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);
 }

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/12] Assorted lustre fixes and improvements NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
  [PATCH 04/12] staging: lustre: ldlm: remove 'first_enq' arg from  ldlm_process_flock_lock() NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
  [PATCH 03/12] staging: lustre: llite: fix various issues with  ll_splice_alias. NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
    Re: [PATCH 03/12] staging: lustre: llite: fix various issues with ll_splice_alias. Oleg Drokin <oleg.drokin@intel.com> - 2017-07-19 05:00 +0200
      Re: [PATCH 03/12] staging: lustre: llite: fix various issues with ll_splice_alias. NeilBrown <neilb@suse.com> - 2017-07-19 06:40 +0200
        Re: [PATCH 03/12] staging: lustre: llite: fix various issues with ll_splice_alias. Oleg Drokin <oleg.drokin@intel.com> - 2017-07-19 08:20 +0200
  [PATCH 02/12] staging: lustre: llite: fix incorrect  DCACHE_DISCONNECTED test NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
  [PATCH 08/12] staging: lustre: ldlm: remove unused 'overlaps'  variable NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
  [PATCH 11/12] staging: lustre: ldlm: remove unnecessary 'ownlocks'  variable. NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
  [PATCH 05/12] staging: lustre: ldlm: remove unused 'work_list' arg  from ldlm_process_flock_lock() NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200

csiph-web