f2fs: correct return value of f2fs_trim_fs
authorChao Yu <yuchao0@huawei.com>
Sun, 8 Apr 2018 12:39:03 +0000 (20:39 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 31 May 2018 18:31:45 +0000 (11:31 -0700)
Correct return value in two cases:
- return EINVAL if end boundary is out-of-range.
- return EIO if fs needs off-line check.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c

index 0fb006f591a4c51081f9487ce5c711cfa723e1f0..08b8f2d4faef689ce092130d061d899f75ec2f18 100644 (file)
@@ -2409,12 +2409,12 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
                return -EINVAL;
 
        if (end <= MAIN_BLKADDR(sbi))
-               goto out;
+               return -EINVAL;
 
        if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) {
                f2fs_msg(sbi->sb, KERN_WARNING,
                        "Found FS corruption, run fsck to fix.");
-               goto out;
+               return -EIO;
        }
 
        /* start/end segment number in main_area */