From 3c0b5e5a734da58e86bf46dffda9913ba4932d13 Mon Sep 17 00:00:00 2001 From: Ann Koehler Date: Thu, 25 Jul 2013 16:07:57 -0500 Subject: [PATCH] LU-3641 libcfs: Zero fill shrinker struct in cfs_set_shrinker 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 Change-Id: I3efa3a858f5d367f73596f38bb4e40b51c2ac5e7 Reviewed-on: http://review.whamcloud.com/7122 Reviewed-by: Patrick Farrell Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Bob Glossman --- libcfs/include/libcfs/linux/linux-mem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcfs/include/libcfs/linux/linux-mem.h b/libcfs/include/libcfs/linux/linux-mem.h index 43e4f5c..3554dfe 100644 --- a/libcfs/include/libcfs/linux/linux-mem.h +++ b/libcfs/include/libcfs/linux/linux-mem.h @@ -128,7 +128,7 @@ struct shrinker *set_shrinker(int seek, shrinker_t func) { struct shrinker *s; - s = kmalloc(sizeof(*s), GFP_KERNEL); + s = kzalloc(sizeof(*s), GFP_KERNEL); if (s == NULL) return (NULL); -- 1.8.3.1