aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2011-06-22 04:51:09 -0400
committerJan Kara <jack@suse.cz>2011-06-25 11:29:53 -0400
commit2c2ea9451fc2a12ee57c8346f0da26969d07ee7f (patch)
tree060666a2cdacc6d5b1f1c10982be0053ac6f9855 /fs/ext3
parent81fe8c62febade6b5d0915269b06a0c50448da27 (diff)
ext3: Return -EINVAL when start is beyond the end of fs in ext3_trim_fs()
We should return -EINVAL when the FITRIM parameters are not sane, but currently we are exiting silently if start is beyond the end of the file system. This commit fixes this so we return -EINVAL as other file systems do. Signed-off-by: Lukas Czerner <lczerner@redhat.com> CC: Jan Kara <jack@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/balloc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index f7d111e499a..6386d76f44a 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -2108,7 +2108,7 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
2108 if (unlikely(minlen > EXT3_BLOCKS_PER_GROUP(sb))) 2108 if (unlikely(minlen > EXT3_BLOCKS_PER_GROUP(sb)))
2109 return -EINVAL; 2109 return -EINVAL;
2110 if (start >= max_blks) 2110 if (start >= max_blks)
2111 goto out; 2111 return -EINVAL;
2112 if (start + len > max_blks) 2112 if (start + len > max_blks)
2113 len = max_blks - start; 2113 len = max_blks - start;
2114 2114
@@ -2156,8 +2156,6 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
2156 2156
2157 if (ret >= 0) 2157 if (ret >= 0)
2158 ret = 0; 2158 ret = 0;
2159
2160out:
2161 range->len = trimmed * sb->s_blocksize; 2159 range->len = trimmed * sb->s_blocksize;
2162 2160
2163 return ret; 2161 return ret;