Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09f363c7 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Linus Torvalds
Browse files

vmscan: fix shrinker callback bug in fs/super.c



The callback must not return -1 when nr_to_scan is zero. Fix the bug in
fs/super.c and add this requirement to the callback specification.

Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 20c8c628
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -61,7 +61,7 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc)
		return -1;
		return -1;


	if (!grab_super_passive(sb))
	if (!grab_super_passive(sb))
		return -1;
		return !sc->nr_to_scan ? 0 : -1;


	if (sb->s_op && sb->s_op->nr_cached_objects)
	if (sb->s_op && sb->s_op->nr_cached_objects)
		fs_objects = sb->s_op->nr_cached_objects(sb);
		fs_objects = sb->s_op->nr_cached_objects(sb);
+1 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ struct shrink_control {
 * 'nr_to_scan' entries and attempt to free them up.  It should return
 * 'nr_to_scan' entries and attempt to free them up.  It should return
 * the number of objects which remain in the cache.  If it returns -1, it means
 * the number of objects which remain in the cache.  If it returns -1, it means
 * it cannot do any scanning at this time (eg. there is a risk of deadlock).
 * it cannot do any scanning at this time (eg. there is a risk of deadlock).
 * The callback must not return -1 if nr_to_scan is zero.
 *
 *
 * The 'gfpmask' refers to the allocation we are currently trying to
 * The 'gfpmask' refers to the allocation we are currently trying to
 * fulfil.
 * fulfil.