linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH -next] f2fs: add f2fs_gc exception handle in f2fs_ioc_gc_range
@ 2020-06-23  7:14 z00520423
  2020-06-23  9:34 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: z00520423 @ 2020-06-23  7:14 UTC (permalink / raw)
  To: yuchao0, jaegeuk; +Cc: zhangqilong3, linux-f2fs-devel

From: Qilong Zhang <zhangqilong3@huawei.com>

When f2fs_ioc_gc_range performs multiple segments gc ops, the return
value of f2fs_ioc_gc_range is determined by the last segment gc ops.
If its ops failed, the f2fs_ioc_gc_range will be considered to be failed
despite some of previous segments gc ops succeeded. Therefore, so we
fix: only all of segments gc ops are finished will return success.

Signed-off-by: Qilong Zhang <zhangqilong3@huawei.com>
---
 fs/f2fs/file.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 3268f8dd59bb..b81fcf9b123d 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2527,6 +2527,10 @@ static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg)
 	}
 
 	ret = f2fs_gc(sbi, range.sync, true, GET_SEGNO(sbi, range.start));
+	if (ret) {
+		ret = -EAGAIN;
+		goto out;
+	}
 	range.start += BLKS_PER_SEC(sbi);
 	if (range.start <= end)
 		goto do_more;
-- 
2.17.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2020-06-23  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23  7:14 [f2fs-dev] [PATCH -next] f2fs: add f2fs_gc exception handle in f2fs_ioc_gc_range z00520423
2020-06-23  9:34 ` 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).