Skip to contentSkip to conversation

Patch "don't remove from shrink list in select_collect()" has been added to the 3.14-stable tree

PATCH [email protected] 1 participant 1 message Aug 14, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

don't remove from shrink list in select_collect()

to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
don-t-remove-from-shrink-list-in-select_collect.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From fe91522a7ba82ca1a51b07e19954b3825e4aaa22 Mon Sep 17 00:00:00 2001

From: Al Viro <[email protected]>
Date: Sat, 3 May 2014 00:02:25 -0400
Subject: don't remove from shrink list in select_collect()

From: Al Viro <[email protected]>

commit fe91522a7ba82ca1a51b07e19954b3825e4aaa22 upstream.

If we find something already on a shrink list, just increment
data->found and do nothing else. Loops in shrink_dcache_parent() and check_submounts_and_drop() will do the right thing - everything we did put into our list will be evicted and if there had been nothing, but data->found got non-zero, well, we have somebody else shrinking those guys; just try again.

Cc "Nicholas A. Bellinger" <[email protected]>
---
 fs/dcache.c |   31 ++++++++++---------------------
 1 file changed, 10 insertions(+), 21 deletions(-)
fs/dcache.c +10 -21
@@ -1231,34 +1231,23 @@ static enum d_walk_ret select_collect(vo
 	if (data->start == dentry)
 		goto out;
 
-	/*
-	 * move only zero ref count dentries to the dispose list.
-	 *
-	 * Those which are presently on the shrink list, being processed
-	 * by shrink_dentry_list(), shouldn't be moved.  Otherwise the
-	 * loop in shrink_dcache_parent() might not make any progress
-	 * and loop forever.
-	 */
-	if (dentry->d_lockref.count) {
-		dentry_lru_del(dentry);
-	} else if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) {
-		/*
-		 * We can't use d_lru_shrink_move() because we
-		 * need to get the global LRU lock and do the
-		 * LRU accounting.
-		 */
-		d_lru_del(dentry);
-		d_shrink_add(dentry, &data->dispose);
+	if (dentry->d_flags & DCACHE_SHRINK_LIST) {
 		data->found++;
-		ret = D_WALK_NORETRY;
+	} else {
+		if (dentry->d_flags & DCACHE_LRU_LIST)
+			d_lru_del(dentry);
+		if (!dentry->d_lockref.count) {
+			d_shrink_add(dentry, &data->dispose);
+			data->found++;
+		}
 	}
 	/*
 	 * We can return to the caller if we have found some (this
 	 * ensures forward progress). We'll be coming back to find
 	 * the rest.
 	 */
-	if (data->found && need_resched())
-		ret = D_WALK_QUIT;
+	if (!list_empty(&data->dispose))
+		ret = need_resched() ? D_WALK_QUIT : D_WALK_NORETRY;
 out:
 	return ret;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-3.14/new-helper-dentry_free.patch queue-3.14/don-t-remove-from-shrink-list-in-select_collect.patch queue-3.14/fold-try_prune_one_dentry.patch queue-3.14/more-graceful-recovery-in-umount_collect.patch queue-3.14/expand-the-call-of-dentry_lru_del-in-dentry_kill.patch queue-3.14/dcache-don-t-need-rcu-in-shrink_dentry_list.patch queue-3.14/path_openat-fix-double-fput.patch
queue-3.14/fold-d_kill-and-d_free.patch queue-3.14/ipc-modify-message-queue-accounting-to-not-take-kernel-data-structures-into-account.patch queue-3.14/dentry_kill-don-t-try-to-remove-from-shrink-list.patch queue-3.14/sg_start_req-make-sure-that-there-s-not-too-many-elements-in-iovec.patch