linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] f2fs: release locks before return in f2fs_ioc_gc_range()
@ 2018-03-13 11:42 sunqiuyang
  2018-03-16  8:21 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: sunqiuyang @ 2018-03-13 11:42 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: sunqiuyang

From: Qiuyang Sun <sunqiuyang@huawei.com>

Currently, we will leave the kernel with locks still held when the gc_range
is invalid. This patch fixes the bug.

Signed-off-by: Qiuyang Sun <sunqiuyang@huawei.com>
---
 fs/f2fs/file.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index c4c27e6..ee88058 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2059,8 +2059,10 @@ static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg)
 		return ret;
 
 	end = range.start + range.len;
-	if (range.start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi))
-		return -EINVAL;
+	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)) {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] f2fs: release locks before return in f2fs_ioc_gc_range()
  2018-03-13 11:42 [PATCH 1/1] f2fs: release locks before return in f2fs_ioc_gc_range() sunqiuyang
@ 2018-03-16  8:21 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2018-03-16  8:21 UTC (permalink / raw)
  To: sunqiuyang, linux-kernel, linux-fsdevel, linux-f2fs-devel

On 2018/3/13 19:42, sunqiuyang wrote:
> From: Qiuyang Sun <sunqiuyang@huawei.com>
> 
> Currently, we will leave the kernel with locks still held when the gc_range
> is invalid. This patch fixes the bug.
> 
> Signed-off-by: Qiuyang Sun <sunqiuyang@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-16  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 11:42 [PATCH 1/1] f2fs: release locks before return in f2fs_ioc_gc_range() sunqiuyang
2018-03-16  8:21 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).