f2fs: fix to return EIO when reading after device removal
Chao Yu
maintainerPATCH 1/1 f2fs: fix to return EIO when reading after device removal
generic/730 2s ... - output mismatch (see /media/fstests/results//generic/730.out.bad)
--- tests/generic/730.out 2023-08-07 01:39:51.055568499 +0000
+++ /media/fstests/results//generic/730.out.bad 2024-02-06 02:26:43.000000000 +0000
@@ -1,2 +1 @@
QA output created by 730
-cat: -: Input/output error
...
(Run 'diff -u /media/fstests/tests/generic/730.out /media/fstests/results//generic/730.out.bad' to see the entire diff)Ran: generic/730
Failures: generic/730
Failed 1 of 1 tests
This patch adds a check condition in f2fs_file_read_iter() to detect cp_error status after device removal, and retrurn -EIO for such case.
--- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/file.c +3 -0
@@ -4462,6 +4462,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)const loff_t pos = iocb->ki_pos;ssize_t ret; +if (unlikely (f2fs_cp_error (F2FS_I_SB (inode)))) +return -EIO ; +if (!f2fs_is_compress_backend_ready (inode))return -EOPNOTSUPP ;
Signature · 1 line
2.40.1
Jaegeuk Kim
maintainerQuoted 8 lines · Chao Yu
generic/730 2s ... - output mismatch (see /media/fstests/results//generic/730.out.bad)
--- tests/generic/730.out 2023-08-07 01:39:51.055568499 +0000 +++ /media/fstests/results//generic/730.out.bad 2024-02-06 02:26:43.000000000 +0000 @@ -1,2 +1 @@ QA output created by 730 -cat: -: Input/output error ... (Run 'diff -u /media/fstests/tests/generic/730.out /media/fstests/results//generic/730.out.bad' to see the entire diff)
Quoted 7 lines
Ran: generic/730
Failures: generic/730
Failed 1 of 1 testsThis patch adds a check condition in
f2fs_file_read_iter()to detectcp_errorstatus after device removal, and retrurn-EIOfor such case.
Can we check device removal?
Quoted 22 lines
Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+)fs/f2fs/file.c +3
-0@@ -4462,6 +4462,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)const loff_t pos = iocb->ki_pos;ssize_t ret; +if (unlikely (f2fs_cp_error (F2FS_I_SB (inode)))) +return -EIO ; +if (!f2fs_is_compress_backend_ready (inode))return -EOPNOTSUPP ;Signature · 1 line
2.40.1
Chao Yu
maintainerQuoted 13 lines · Jaegeuk Kim
Quoted 12 lines · Chao Yu
generic/730 2s ... - output mismatch (see /media/fstests/results//generic/730.out.bad)
--- tests/generic/730.out 2023-08-07 01:39:51.055568499 +0000 +++ /media/fstests/results//generic/730.out.bad 2024-02-06 02:26:43.000000000 +0000 @@ -1,2 +1 @@ QA output created by 730 -cat: -: Input/output error ... (Run 'diff -u /media/fstests/tests/generic/730.out /media/fstests/results//generic/730.out.bad' to see the entire diff)Ran: generic/730
Failures: generic/730
Failed 1 of 1 tests
Quoted 5 lines
Quoted 3 lines
This patch adds a check condition in
f2fs_file_read_iter()to detectcp_errorstatus after device removal, and retrurn-EIOfor such case.Can we check device removal?
We can use blk_queue_dying() to detect device removal, but, IMO, device removal can almost not happen in Android, not sure for distros or server, do you want to add this check condition into f2fs_cp_error()?
Thanks,
Quoted 23 lines
Quoted 23 lines
Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+)fs/f2fs/file.c +3
-0@@ -4462,6 +4462,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)const loff_t pos = iocb->ki_pos;ssize_t ret; +if (unlikely (f2fs_cp_error (F2FS_I_SB (inode)))) +return -EIO ; +if (!f2fs_is_compress_backend_ready (inode))return -EOPNOTSUPP ;Signature · 1 line
2.40.1
Chao Yu
maintainerAny comments?
Thanks,
Quoted 53 lines · Chao Yu
Quoted 13 lines · Jaegeuk Kim
Quoted 12 lines · Chao Yu
generic/730 2s ... - output mismatch (see /media/fstests/results//generic/730.out.bad)
--- tests/generic/730.out 2023-08-07 01:39:51.055568499 +0000
+++ /media/fstests/results//generic/730.out.bad 2024-02-06 02:26:43.000000000 +0000
@@ -1,2 +1 @@
QA output created by 730
-cat: -: Input/output error
...
(Run 'diff -u /media/fstests/tests/generic/730.out /media/fstests/results//generic/730.out.bad' to see the entire diff)
Ran: generic/730
Failures: generic/730
Failed 1 of 1 testsQuoted 5 lines
Quoted 3 lines
This patch adds a check condition in
f2fs_file_read_iter()to detectcp_errorstatus after device removal, and retrurn-EIOfor such case.Can we check device removal?
We can use
blk_queue_dying()to detect device removal, but, IMO, device removal can almost not happen in Android, not sure for distros or server, do you want to add this check condition intof2fs_cp_error()?Thanks,
Quoted 7 lines
Quoted 7 lines
Signed-off-by Chao Yu <[email protected]>---
fs/f2fs/file.c| 3 +++1 file changed, 3 insertions(+)Quoted 14 lines
Quoted 14 lines
fs/f2fs/file.c +3
-0@@ -4462,6 +4462,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) const loff_t pos = iocb->ki_pos; ssize_t ret; + if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) + return -EIO; + if (!f2fs_is_compress_backend_ready(inode)) return -EOPNOTSUPP;Signature · 1 line
2.40.1_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerPing,
Jaegeuk, do you have any comments on this patch?
Thanks,
Quoted 64 lines · Chao Yu
Any comments?
Thanks,
Quoted 45 lines · Chao Yu
Quoted 13 lines · Jaegeuk Kim
Quoted 12 lines · Chao Yu
generic/730 2s ... - output mismatch (see /media/fstests/results//generic/730.out.bad)
--- tests/generic/730.out 2023-08-07 01:39:51.055568499 +0000
+++ /media/fstests/results//generic/730.out.bad 2024-02-06 02:26:43.000000000 +0000
@@ -1,2 +1 @@
QA output created by 730
-cat: -: Input/output error
...
(Run 'diff -u /media/fstests/tests/generic/730.out /media/fstests/results//generic/730.out.bad' to see the entire diff)
Ran: generic/730
Failures: generic/730
Failed 1 of 1 testsQuoted 5 lines
Quoted 3 lines
This patch adds a check condition in
f2fs_file_read_iter()to detectcp_errorstatus after device removal, and retrurn-EIOfor such case.Can we check device removal?
We can use
blk_queue_dying()to detect device removal, but, IMO, device removal can almost not happen in Android, not sure for distros or server, do you want to add this check condition intof2fs_cp_error()?Thanks,
Quoted 19 lines
Quoted 19 lines
Signed-off-by Chao Yu <[email protected]>---
fs/f2fs/file.c| 3 +++1 file changed, 3 insertions(+)fs/f2fs/file.c +3
-0@@ -4462,6 +4462,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) const loff_t pos = iocb->ki_pos; ssize_t ret; + if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) + return -EIO; + if (!f2fs_is_compress_backend_ready(inode)) return -EOPNOTSUPP;Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
2.40.1_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerSo, I was wondering we can give data even in cp_error case.
Quoted 71 lines · Chao Yu
Ping,
Jaegeuk, do you have any comments on this patch?
Thanks,
Quoted 64 lines · Chao Yu
Any comments?
Thanks,
Quoted 45 lines · Chao Yu
Quoted 13 lines · Jaegeuk Kim
Quoted 12 lines · Chao Yu
generic/730 2s ... - output mismatch (see /media/fstests/results//generic/730.out.bad)
--- tests/generic/730.out 2023-08-07 01:39:51.055568499 +0000
+++ /media/fstests/results//generic/730.out.bad 2024-02-06 02:26:43.000000000 +0000
@@ -1,2 +1 @@
QA output created by 730
-cat: -: Input/output error
...
(Run 'diff -u /media/fstests/tests/generic/730.out /media/fstests/results//generic/730.out.bad' to see the entire diff)
Ran: generic/730
Failures: generic/730
Failed 1 of 1 testsQuoted 5 lines
Quoted 3 lines
This patch adds a check condition in
f2fs_file_read_iter()to detectcp_errorstatus after device removal, and retrurn-EIOfor such case.Can we check device removal?
We can use
blk_queue_dying()to detect device removal, but, IMO, device removal can almost not happen in Android, not sure for distros or server, do you want to add this check condition intof2fs_cp_error()?Thanks,
Quoted 19 lines
Quoted 19 lines
Signed-off-by Chao Yu <[email protected]>---
fs/f2fs/file.c| 3 +++1 file changed, 3 insertions(+)fs/f2fs/file.c +3
-0@@ -4462,6 +4462,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) const loff_t pos = iocb->ki_pos; ssize_t ret; + if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) + return -EIO; + if (!f2fs_is_compress_backend_ready(inode)) return -EOPNOTSUPP;Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
2.40.1_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel