It seems that commit d23da150a37c ("fs/superblock: avoid locking
   counting inodes and dentries before reclaiming them")
wasn't applied correctly durring rebase to RHEL 7.2.
Fix this up.

https://bugs.openvz.org/browse/OVZ-6646

Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com>
---
 fs/super.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 909d943..d09e15a 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -73,6 +73,9 @@ static unsigned long super_cache_scan(struct shrinker *shrink,
        if (!(sc->gfp_mask & __GFP_FS))
                return SHRINK_STOP;
 
+       if (!grab_super_passive(sb))
+                return SHRINK_STOP;
+
        if (sb->s_op && sb->s_op->nr_cached_objects)
                fs_objects = sb->s_op->nr_cached_objects(sb, sc);
 
@@ -111,9 +114,14 @@ static unsigned long super_cache_count(struct shrinker 
*shrink,
 
        sb = container_of(shrink, struct super_block, s_shrink);
 
-       if (!grab_super_passive(sb))
-               return 0;
-
+       /*
+        * Don't call grab_super_passive as it is a potential
+        * scalability bottleneck. The counts could get updated
+        * between super_cache_count and super_cache_scan anyway.
+        * Call to super_cache_count with shrinker_rwsem held
+        * ensures the safety of call to list_lru_count_node() and
+        * s_op->nr_cached_objects().
+        */
        if (sb->s_op && sb->s_op->nr_cached_objects)
                total_objects = sb->s_op->nr_cached_objects(sb, sc);
 
-- 
2.4.10

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to