]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vmscan: fix shrinker callback bug in fs/super.c
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 28 Sep 2011 00:50:23 +0000 (10:50 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 29 Sep 2011 06:08:11 +0000 (16:08 +1000)
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: Mikulas Patocka <mpatocka@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: Andrew Morton <>
fs/super.c
include/linux/shrinker.h

index 631e0ca155b46287f905e70f570110b2c072456b..360045ece782c1115b693a798bd4281302dbe4d7 100644 (file)
@@ -61,7 +61,7 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc)
                return -1;
 
        if (!grab_super_passive(sb))
-               return -1;
+               return !sc->nr_to_scan ? 0 : -1;
 
        if (sb->s_op && sb->s_op->nr_cached_objects)
                fs_objects = sb->s_op->nr_cached_objects(sb);
index ac6b8ee07825ee6ce99dff9faf9901a224a97b5e..07ceb97d53facc505bae4b489d3cae96bd7d4021 100644 (file)
@@ -20,6 +20,7 @@ struct shrink_control {
  * '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
  * 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
  * fulfil.