Commit d68aab6b authored by Niu Yawei's avatar Niu Yawei Committed by Jan Kara

quota: missing lock in dqcache_shrink_scan()

Commit 1ab6c499 (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@vger.kernel.org
Fixes: 1ab6c499Signed-off-by: default avatarNiu Yawei <yawei.niu@intel.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 1795cd9b
...@@ -702,6 +702,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) ...@@ -702,6 +702,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
struct dquot *dquot; struct dquot *dquot;
unsigned long freed = 0; unsigned long freed = 0;
spin_lock(&dq_list_lock);
head = free_dquots.prev; head = free_dquots.prev;
while (head != &free_dquots && sc->nr_to_scan) { while (head != &free_dquots && sc->nr_to_scan) {
dquot = list_entry(head, struct dquot, dq_free); dquot = list_entry(head, struct dquot, dq_free);
...@@ -713,6 +714,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) ...@@ -713,6 +714,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
freed++; freed++;
head = free_dquots.prev; head = free_dquots.prev;
} }
spin_unlock(&dq_list_lock);
return freed; return freed;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment