Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 305b2dee authored by Yunlei He's avatar Yunlei He Committed by Jaegeuk Kim
Browse files

f2fs: move mnt_want_write_file after range check



This patch move mnt_want_write_file after range check,
it's needless to check arguments with it.

Signed-off-by: default avatarYunlei He <heyunlei@huawei.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 7a01aa64
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -2066,15 +2066,15 @@ static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg)
	if (f2fs_readonly(sbi->sb))
		return -EROFS;

	end = range.start + range.len;
	if (range.start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi)) {
		return -EINVAL;
	}

	ret = mnt_want_write_file(filp);
	if (ret)
		return ret;

	end = range.start + range.len;
	if (range.start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi)) {
		ret = -EINVAL;
		goto out;
	}
do_more:
	if (!range.sync) {
		if (!mutex_trylock(&sbi->gc_mutex)) {