Skip to content

Commit

Permalink
quota: missing lock in dqcache_shrink_scan()
Browse files Browse the repository at this point in the history
Commit 1ab6c49 (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: [email protected]
Fixes: 1ab6c49
Signed-off-by: Niu Yawei <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
NiuYawei authored and jankara committed Jul 15, 2014
1 parent 1795cd9 commit d68aab6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,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);
Expand All @@ -713,6 +714,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
freed++;
head = free_dquots.prev;
}
spin_unlock(&dq_list_lock);
return freed;
}

Expand Down

0 comments on commit d68aab6

Please sign in to comment.