ext4: do not use stripe_width if it is not set
authorJan Kara <jack@suse.cz>
Sat, 7 Oct 2017 22:36:49 +0000 (22:36 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Nov 2017 09:08:34 +0000 (10:08 +0100)
[ Upstream commit 5469d7c3087ecaf760f54b447f11af6061b7c897 ]

Avoid using stripe_width for sbi->s_stripe value if it is not actually
set. It prevents using the stride for sbi->s_stripe.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/super.c

index f72535e..1f58179 100644 (file)
@@ -2628,9 +2628,9 @@ static unsigned long ext4_get_stripe_size(struct ext4_sb_info *sbi)
 
        if (sbi->s_stripe && sbi->s_stripe <= sbi->s_blocks_per_group)
                ret = sbi->s_stripe;
-       else if (stripe_width <= sbi->s_blocks_per_group)
+       else if (stripe_width && stripe_width <= sbi->s_blocks_per_group)
                ret = stripe_width;
-       else if (stride <= sbi->s_blocks_per_group)
+       else if (stride && stride <= sbi->s_blocks_per_group)
                ret = stride;
        else
                ret = 0;