This patch stop async thread and umount process to issue discard
if something wrong with f2fs, which is similar to fstrim.

v1->v2: add fs error check in not only discard thread but also umount process
v2->v3: remove redundant error message

Signed-off-by: Yunlei He <heyun...@huawei.com>
---
 fs/f2fs/segment.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 5854cc4..e31d506 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1202,6 +1202,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
        int i, iter = 0, issued = 0;
        bool io_interrupted = false;
 
+       if (is_sbi_flag_set(sbi, SBI_NEED_FSCK))
+               return issued;
+
        for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
                if (i + 1 < dpolicy->granularity)
                        break;
-- 
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to