Whamcloud - gitweb
LU-3641 libcfs: Zero fill shrinker struct in cfs_set_shrinker 22/7122/3
authorAnn Koehler <amk@cray.com>
Thu, 25 Jul 2013 21:07:57 +0000 (16:07 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 31 Jul 2013 19:14:14 +0000 (19:14 +0000)
Dropping Lustre caches might not terminate if the Linux kernel
supports the customisable shrinker batch size feature (commit
e9299f5058595a655c3b207cda9635e28b9197e6). This kernel feature
added a new field (batch) to the shrinker struct. Lustre does
not initialize it. When the unitialized batch value is negative,
the kernel shrink_slab function never terminates its loop that
calls the Lustre shrinker function. The problem was observed
with the ldlm_pools_cli_shrink shrinker, but it could also happen
with other Lustre shrinkers.

The fix is to ensure that all fields of the shrinker struct are
initialized by zero filling the struct when cfs_set_shrinker
allocates it. Zero filling works with all versions of the kernel.

Signed-off-by: Ann Koehler <amk@cray.com>
Change-Id: I3efa3a858f5d367f73596f38bb4e40b51c2ac5e7
Reviewed-on: http://review.whamcloud.com/7122
Reviewed-by: Patrick Farrell <paf@cray.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
libcfs/include/libcfs/linux/linux-mem.h

index 43e4f5c..3554dfe 100644 (file)
@@ -128,7 +128,7 @@ struct shrinker *set_shrinker(int seek, shrinker_t func)
 {
         struct shrinker *s;
 
 {
         struct shrinker *s;
 
-        s = kmalloc(sizeof(*s), GFP_KERNEL);
+       s = kzalloc(sizeof(*s), GFP_KERNEL);
         if (s == NULL)
                 return (NULL);
 
         if (s == NULL)
                 return (NULL);