ext4: fix return value for ext4_es_scan()
Theodore Ts'o [Mon, 6 Jul 2015 16:19:04 +0000 (12:19 -0400)]
Between 3.10 and 3.18, the abstraction to scan for objects in the slab
cache which can be freed when the system is under memory pressure
changed.  When I backported the ext4 code from 3.18 to the 3.10
kernel, I didn't get the return value required by the calling
conventions for the scan function correct, which could potentially
cause the memory reclaimer to loop indefinitely.

Bug=21907245

Change-Id: I3b13c9878663f409a100123ec3890114beb64172
Signed-off-by: "Theodore Ts'o" <tytso@google.com>

fs/ext4/extents_status.c

index 96f11da..4603652 100644 (file)
@@ -1085,7 +1085,7 @@ static unsigned long ext4_es_scan(struct shrinker *shrink,
        nr_shrunk = __ext4_es_shrink(sbi, nr_to_scan, NULL);
 
        trace_ext4_es_shrink_scan_exit(sbi->s_sb, nr_shrunk, ret);
-       return nr_shrunk;
+       return percpu_counter_read_positive(&sbi->s_es_stats.es_stats_lru_cnt);
 }
 
 static int ext4_es_shrink(struct shrinker *shrink, struct shrink_control *sc)