[Devel] [PATCH RHEL7 COMMIT] quota: missing lock in dqcache_shrink_scan()

Vladimir Davydov vdavydov at odin.com
Mon Sep 7 03:15:48 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.7
------>
commit 51364e080f990bd1ac9b4a7a8b8ba036d806ccb9
Author: Niu Yawei <yawei.niu at gmail.com>
Date:   Mon Sep 7 14:15:48 2015 +0400

    quota: missing lock in dqcache_shrink_scan()
    
    Commit 1ab6c4997e04 (fs: convert fs shrinkers to new scan/count API)
    accidentally removed locking from quota shrinker. Fix it -
    dqcache_shrink_scan() should use dq_list_lock to protect the
    scan on free_dquots list.
    
    CC: stable at vger.kernel.org
    Fixes: 1ab6c4997e04a00c50c6d786c2f046adc0d1f5de
    Signed-off-by: Niu Yawei <yawei.niu at intel.com>
    Signed-off-by: Jan Kara <jack at suse.cz>
    (cherry picked from commit d68aab6b8f572406aa93b45ef6483934dd3b54a6)
    Reported-by: Alexey Lyashkov <umka at cloudlinux.com>
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 fs/quota/dquot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 6f78cdcdecf2..0928842a95ed 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -690,6 +690,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 	struct dquot *dquot;
 	unsigned long freed = 0;
 
+	spin_lock(&dq_list_lock);
 	head = free_dquots.prev;
 	while (head != &free_dquots && sc->nr_to_scan) {
 		dquot = list_entry(head, struct dquot, dq_free);
@@ -701,6 +702,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 		freed++;
 		head = free_dquots.prev;
 	}
+	spin_unlock(&dq_list_lock);
 	return freed;
 }
 



More information about the Devel mailing list