The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.46.x-ovz" and will 
appear at
after rh7-3.10.0-693.21.1.vz7.46.5
commit 98ec64d9082be9d0b5594a0ecd98021fa995ba82
Author: Konstantin Khorenko <>
Date:   Fri Apr 13 19:22:22 2018 +0300

    ext4: don't iterate over sbi->s_es_list more than the number of elements
    If there are several shrinkers working on a single sbi there can be easily a
    situation when a neighbor shrinkers reclaimed a bunch of extents and thus a
    bunch inoes from the s_es_list but we don't honor this and iterate over
    sbi->s_es_list the number of times equal to the initial number of inodes in
    Before each iteration, check if we are going to iterate more than the 
number of
    inodes in the list and adjust nr_to_walk accordingly.
    Signed-off-by: Konstantin Khorenko <>
    Acked-by: Dmitry Monakhov <>
 fs/ext4/extents_status.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index a3b9c480ec20..ed1f63eef74c 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -998,6 +998,14 @@ static int __es_shrink(struct ext4_sb_info *sbi, int 
                        goto out;
+               /*
+                * Another shrinker can remove a bunch of extents in parallel,
+                * we don't have to iterate more than the current number of
+                * inodes in the list.
+                */
+               if (nr_to_walk > sbi->s_es_nr_inode)
+                       nr_to_walk = sbi->s_es_nr_inode;
                ei = list_first_entry(&sbi->s_es_list, struct ext4_inode_info,
                /* Move the inode to the tail */
Devel mailing list

Reply via email to