diff --git a/fs/dcache.c b/fs/dcache.c index 8e166a4..c7cd9ee 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -118,7 +118,14 @@ struct dentry_stat_t dentry_stat = { }; static DEFINE_PER_CPU(unsigned int, nr_dentry); -static DEFINE_PER_CPU(unsigned int, nr_dentry_unused); +/* + * The total counts for nr_dentry_unused are hotplug-safe, since we always loop + * through all possible cpus. It is quite possible, though, that the counters + * go negative. That could easily happen for a dentry that is marked unused in + * one CPU but decrements that count after being preempted to another CPU. + * Therefore, we must use a signed quantity in here. + */ +static DEFINE_PER_CPU(long , nr_dentry_unused); #if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) static int get_nr_dentry(void)