]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
quota: fix wrong condition in is_quota_modification()
authorChao Yu <yuchao0@huawei.com>
Wed, 11 Sep 2019 09:36:50 +0000 (17:36 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 28 Apr 2020 18:02:19 +0000 (19:02 +0100)
commit4882b2820c473d31df4f1b37f96d50e7705603f3
treedb6376cd30c8778d5aab7f0d0c08f4228459d224
parent25b627e77e45b3f83283d6d6ce6717cee4148150
quota: fix wrong condition in is_quota_modification()

commit 6565c182094f69e4ffdece337d395eb7ec760efc upstream.

Quoted from
commit 3da40c7b0898 ("ext4: only call ext4_truncate when size <= isize")

" At LSF we decided that if we truncate up from isize we shouldn't trim
  fallocated blocks that were fallocated with KEEP_SIZE and are past the
 new i_size.  This patch fixes ext4 to do this. "

And generic/092 of fstest have covered this case for long time, however
is_quota_modification() didn't adjust based on that rule, so that in
below condition, we will lose to quota block change:
- fallocate blocks beyond EOF
- remount
- truncate(file_path, file_size)

Fix it.

Link: https://lore.kernel.org/r/20190911093650.35329-1-yuchao0@huawei.com
Fixes: 3da40c7b0898 ("ext4: only call ext4_truncate when size <= isize")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
include/linux/quotaops.h