diff options
author | Jan Kara <jack@suse.cz> | 2021-11-12 16:22:02 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-27 09:04:21 +0100 |
commit | 1105c2dac8cb45c297401e32884cbefc0f123301 (patch) | |
tree | 8c9ae56b5b98d3d33ab6b67af9fb23650670f46c /fs/ext4/ioctl.c | |
parent | e0b2cd310d0859907a9a7b4e4ef9a5bcce9d3d6d (diff) | |
download | linux-stable-1105c2dac8cb45c297401e32884cbefc0f123301.tar.gz linux-stable-1105c2dac8cb45c297401e32884cbefc0f123301.tar.bz2 linux-stable-1105c2dac8cb45c297401e32884cbefc0f123301.zip |
ext4: avoid trim error on fs with small groups
[ Upstream commit 173b6e383d2a204c9921ffc1eca3b87aa2106c33 ]
A user reported FITRIM ioctl failing for him on ext4 on some devices
without apparent reason. After some debugging we've found out that
these devices (being LVM volumes) report rather large discard
granularity of 42MB and the filesystem had 1k blocksize and thus group
size of 8MB. Because ext4 FITRIM implementation puts discard
granularity into minlen, ext4_trim_fs() declared the trim request as
invalid. However just silently doing nothing seems to be a more
appropriate reaction to such combination of parameters since user did
not specify anything wrong.
CC: Lukas Czerner <lczerner@redhat.com>
Fixes: 5c2ed62fd447 ("ext4: Adjust minlen with discard_granularity in the FITRIM ioctl")
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20211112152202.26614-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r-- | fs/ext4/ioctl.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 21c9ebfe8347..484cb68c34d9 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -1052,8 +1052,6 @@ resizefs_out: sizeof(range))) return -EFAULT; - range.minlen = max((unsigned int)range.minlen, - q->limits.discard_granularity); ret = ext4_trim_fs(sb, &range); if (ret < 0) return ret; |