diff options
author | Lukas Czerner <lczerner@redhat.com> | 2014-05-12 22:21:43 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-05-12 22:21:43 -0400 |
commit | 0baaea64009d5edbfee36a949017f7c68926fafc (patch) | |
tree | 11a33d777ab93ed1a8df504e18916fafcffb25a6 /fs/ext4 | |
parent | 5d60125530b0122f5a0a57481f3064a6250365dd (diff) | |
download | op-kernel-dev-0baaea64009d5edbfee36a949017f7c68926fafc.zip op-kernel-dev-0baaea64009d5edbfee36a949017f7c68926fafc.tar.gz |
ext4: use EXT_MAX_BLOCKS in ext4_es_can_be_merged()
In ext4_es_can_be_merged() when checking whether we can merge two
extents we should use EXT_MAX_BLOCKS instead of defining it manually.
Also if it is really the case we should notify userspace because clearly
there is a bug in extent status tree implementation since this should
never happen.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/extents_status.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index 98c90f5..3f5c188 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c @@ -344,8 +344,14 @@ static int ext4_es_can_be_merged(struct extent_status *es1, if (ext4_es_status(es1) != ext4_es_status(es2)) return 0; - if (((__u64) es1->es_len) + es2->es_len > 0xFFFFFFFFULL) + if (((__u64) es1->es_len) + es2->es_len > EXT_MAX_BLOCKS) { + pr_warn("ES assertion failed when merging extents. " + "The sum of lengths of es1 (%d) and es2 (%d) " + "is bigger than allowed file size (%d)\n", + es1->es_len, es2->es_len, EXT_MAX_BLOCKS); + WARN_ON(1); return 0; + } if (((__u64) es1->es_lblk) + es1->es_len != es2->es_lblk) return 0; |