[Devel] [PATCH RHEL7 COMMIT] ms/dcache: fold d_kill()

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 27 01:53:09 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.8
------>
commit 48ecc4d1f2afed8654b23df5da4f9a28f6e8f1bd
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Fri May 27 12:53:09 2016 +0400

    ms/dcache: fold d_kill()
    
    Patchset description:
    Backport fix for shrink_dentry_list livelock
    
    https://jira.sw.ru/browse/PSBM-47312
    
    Al Viro (7):
      fold try_prune_one_dentry()
      lift the "already marked killed" case into shrink_dentry_list()
      split dentry_kill()
      expand dentry_kill(dentry, 0) in shrink_dentry_list()
      shrink_dentry_list(): take parent's ->d_lock earlier
      dealing with the rest of shrink_dentry_list() livelock
      dentry_kill() doesn't need the second argument now
    
    Linus Torvalds (1):
      dcache: add missing lockdep annotation
    
    Miklos Szeredi (1):
      dcache: don't need rcu in shrink_dentry_list()
    
    Vladimir Davydov (1):
      fold d_kill()
    
    ============================================
    This patch description:
    
    This partially backports commit 03b3b889e79c ("fold d_kill() and
    d_free()"). I can't backport the whole commit, because d_free() is still
    used elsewhere.
    
    Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 fs/dcache.c | 50 +++++++++++++++-----------------------------------
 1 file changed, 15 insertions(+), 35 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 0c2826d..bfc284d 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -429,40 +429,6 @@ static void dentry_lru_add(struct dentry *dentry)
 		d_lru_add(dentry);
 }
 
-/**
- * d_kill - kill dentry and return parent
- * @dentry: dentry to kill
- * @parent: parent dentry
- *
- * The dentry must already be unhashed and removed from the LRU.
- *
- * If this is the root of the dentry tree, return NULL.
- *
- * dentry->d_lock and parent->d_lock must be held by caller, and are dropped by
- * d_kill.
- */
-static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent)
-	__releases(dentry->d_lock)
-	__releases(parent->d_lock)
-	__releases(dentry->d_inode->i_lock)
-{
-	__list_del_entry(&dentry->d_u.d_child);
-	/*
-	 * Inform d_walk() that we are no longer attached to the
-	 * dentry tree
-	 */
-	dentry->d_flags |= DCACHE_DENTRY_KILLED;
-	if (parent)
-		spin_unlock(&parent->d_lock);
-	dentry_iput(dentry);
-	/*
-	 * dentry_iput drops the locks, at which point nobody (except
-	 * transient RCU lookups) can reach this dentry.
-	 */
-	d_free(dentry);
-	return parent;
-}
-
 /*
  * Unhash a dentry without inserting an RCU walk barrier or checking that
  * dentry->d_lock is locked.  The caller must take care of that, if
@@ -574,7 +540,21 @@ relock:
 	}
 	/* if it was on the hash then remove it */
 	__d_drop(dentry);
-	return d_kill(dentry, parent);
+	__list_del_entry(&dentry->d_u.d_child);
+	/*
+	 * Inform d_walk() that we are no longer attached to the
+	 * dentry tree
+	 */
+	dentry->d_flags |= DCACHE_DENTRY_KILLED;
+	if (parent)
+		spin_unlock(&parent->d_lock);
+	dentry_iput(dentry);
+	/*
+	 * dentry_iput drops the locks, at which point nobody (except
+	 * transient RCU lookups) can reach this dentry.
+	 */
+	d_free(dentry);
+	return parent;
 }
 
 /* 


More information about the Devel mailing list