VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Al Viro <viro@zeniv.linux.org.uk> 2018-04-15 18:31:03 -0400 committer: Al Viro <viro@zeniv.linux.org.uk> 2018-04-15 23:36:58 -0400 commit: 1088a6408ce197bef7ba04b32e6b034e95d6d2c1 parent: 9c5f1d30199d09f7e2776c24ecb63c843ada876d
Commit Summary:
dput(): turn into explicit while() loop
Diffstat:
1 file changed, 13 insertions, 17 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index fd4c6de17b94..c4d2234eccc3 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -828,29 +828,24 @@ static inline bool fast_dput(struct dentry *dentry)
  */
 void dput(struct dentry *dentry)
 {
-	if (unlikely(!dentry))
-		return;
+	while (dentry) {
+		might_sleep();
 
-repeat:
-	might_sleep();
+		rcu_read_lock();
+		if (likely(fast_dput(dentry))) {
+			rcu_read_unlock();
+			return;
+		}
 
-	rcu_read_lock();
-	if (likely(fast_dput(dentry))) {
+		/* Slow case: now with the dentry lock held */
 		rcu_read_unlock();
-		return;
-	}
 
-	/* Slow case: now with the dentry lock held */
-	rcu_read_unlock();
-
-	if (likely(retain_dentry(dentry))) {
-		spin_unlock(&dentry->d_lock);
-		return;
-	}
+		if (likely(retain_dentry(dentry))) {
+			spin_unlock(&dentry->d_lock);
+			return;
+		}
 
-	dentry = dentry_kill(dentry);
-	if (dentry) {
-		goto repeat;
+		dentry = dentry_kill(dentry);
 	}
 }
 EXPORT_SYMBOL(dput);