f2fs: retry to update the inode page given EIO
Subsystems (2)
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: retry to update the inode page given EIO
In f2fs_update_inode_page, f2fs_get_node_page handles EIO along with f2fs_handle_page_eio that stops checkpoint, if the disk couldn't be recovered. As a result, we don't need to stop checkpoint right away given single EIO.
--- fs/f2fs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/inode.c +2 -2
@@ -719,10 +719,10 @@ void f2fs_update_inode_page(struct inode *inode)if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { +if (err == -ENOMEM || err == -EIO ) {cond_resched (); goto retry; - }else if (err != -ENOENT ) { + }else if (err != -ENOENT ||f2fs_cp_error (sbi)) {f2fs_stop_checkpoint (sbi, false,STOP_CP_REASON_UPDATE_INODE ); }
Signature · 8 lines
2.39.0.314.g84b9a713c41-goog _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerIn f2fs_update_inode_page, f2fs_get_node_page handles EIO along with f2fs_handle_page_eio that stops checkpoint, if the disk couldn't be recovered. As a result, we don't need to stop checkpoint right away given single EIO.
---
Change log from v1:
- fix a bug
fs/f2fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/inode.c +1 -1
@@ -719,7 +719,7 @@ void f2fs_update_inode_page(struct inode *inode)if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { +if (err == -ENOMEM || (err == -EIO && !f2fs_cp_error (sbi))) {cond_resched (); goto retry; }else if (err != -ENOENT ) {
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
Chao Yu
maintainerQuoted 3 lines · Jaegeuk Kim
In
f2fs_update_inode_page,f2fs_get_node_pagehandles EIO along withf2fs_handle_page_eiothat stops checkpoint, if the disk couldn't be recovered. As a result, we don't need to stop checkpoint right away given single EIO.
f2fs_handle_page_eio() only covers the case that EIO occurs on the same page, should we cover the case EIO occurs on different pages?
Thanks,
Quoted 25 lines
Signed-off-by Randall Huang <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>---
Change log from v1:
- fix a bugfs/f2fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/inode.c +1
-1@@ -719,7 +719,7 @@ void f2fs_update_inode_page(struct inode *inode)if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { +if (err == -ENOMEM || (err == -EIO && !f2fs_cp_error (sbi))) {cond_resched (); goto retry; }else if (err != -ENOENT ) {
Jaegeuk Kim
maintainerQuoted 7 lines · Chao Yu
Quoted 3 lines · Jaegeuk Kim
In
f2fs_update_inode_page,f2fs_get_node_pagehandles EIO along withf2fs_handle_page_eiothat stops checkpoint, if the disk couldn't be recovered. As a result, we don't need to stop checkpoint right away given single EIO.
f2fs_handle_page_eio()only covers the case that EIO occurs on the same page, should we cover the case EIO occurs on different pages?
Which case are you looking at?
Quoted 15 lines
Thanks,
Quoted 12 lines
Signed-off-by Randall Huang <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>---
Change log from v1:
- fix a bugfs/f2fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
fs/f2fs/inode.c void f2fs_update_inode_page(struct inode *inode) · line 724
Quoted 12 lines
fs/f2fs/inode.c +1
-1@@ -719,7 +719,7 @@ void f2fs_update_inode_page(struct inode *inode)if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { +if (err == -ENOMEM || (err == -EIO && !f2fs_cp_error (sbi))) {cond_resched (); goto retry; }else if (err != -ENOENT ) {
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 10 lines · Jaegeuk Kim
Quoted 7 lines · Chao Yu
Quoted 3 lines · Jaegeuk Kim
In
f2fs_update_inode_page,f2fs_get_node_pagehandles EIO along withf2fs_handle_page_eiothat stops checkpoint, if the disk couldn't be recovered. As a result, we don't need to stop checkpoint right away given single EIO.
f2fs_handle_page_eio()only covers the case that EIO occurs on the same page, should we cover the case EIO occurs on different pages?Which case are you looking at?
- __get_node_page(PageA) - __get_node_page(PageB)
- f2fs_handle_page_eio
- sbi->page_eio_ofs[type] = PageA->index
- f2fs_handle_page_eio
- sbi->page_eio_ofs[type] = PageB->index
In such race case, it may has low probability to set CP_ERROR_FLAG as we expect?
Thanks,
Quoted 16 lines
Quoted 16 lines
Thanks,
Quoted 12 lines
Signed-off-by Randall Huang <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>---
Change log from v1:
- fix a bugfs/f2fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
fs/f2fs/inode.c +0
-0Quoted 8 lines
fs/f2fs/inode.c void f2fs_update_inode_page(struct inode *inode) · line 724
Quoted 8 lines
fs/f2fs/inode.c +1
-1@@ -719,7 +719,7 @@ void f2fs_update_inode_page(struct inode *inode)if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { +if (err == -ENOMEM || (err == -EIO && !f2fs_cp_error (sbi))) {cond_resched (); goto retry; }else if (err != -ENOENT ) {
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerQuoted 12 lines · Chao Yu
Quoted 10 lines · Jaegeuk Kim
Quoted 7 lines · Chao Yu
Quoted 3 lines · Jaegeuk Kim
In
f2fs_update_inode_page,f2fs_get_node_pagehandles EIO along withf2fs_handle_page_eiothat stops checkpoint, if the disk couldn't be recovered. As a result, we don't need to stop checkpoint right away given single EIO.
f2fs_handle_page_eio()only covers the case that EIO occurs on the same page, should we cover the case EIO occurs on different pages?Which case are you looking at?
Quoted 7 lines
-
__get_node_page(PageA)-__get_node_page(PageB)
-f2fs_handle_page_eio
- sbi->page_eio_ofs[type] =PageA->index
-f2fs_handle_page_eio
- sbi->page_eio_ofs[type] =PageB->indexIn such race case, it may has low probability to set
CP_ERROR_FLAGas we expect?
Do you see that case in products?
I'm trying to avoid setting CP_ERROR_FLAG here.
Quoted 19 lines
Thanks,
Quoted 16 lines
Quoted 16 lines
Thanks,
Quoted 12 lines
Signed-off-by Randall Huang <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>---
Change log from v1:
- fix a bugfs/f2fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
fs/f2fs/inode.c +0
-0Quoted 8 lines
Quoted 8 lines
fs/f2fs/inode.c void f2fs_update_inode_page(struct inode *inode) · line 724
Quoted 8 lines
fs/f2fs/inode.c +1
-1@@ -719,7 +719,7 @@ void f2fs_update_inode_page(struct inode *inode)if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { +if (err == -ENOMEM || (err == -EIO && !f2fs_cp_error (sbi))) {cond_resched (); goto retry; }else if (err != -ENOENT ) {
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 19 lines · Jaegeuk Kim
Quoted 18 lines · Chao Yu
Quoted 10 lines · Jaegeuk Kim
Quoted 7 lines · Chao Yu
Quoted 3 lines · Jaegeuk Kim
In
f2fs_update_inode_page,f2fs_get_node_pagehandles EIO along withf2fs_handle_page_eiothat stops checkpoint, if the disk couldn't be recovered. As a result, we don't need to stop checkpoint right away given single EIO.
f2fs_handle_page_eio()only covers the case that EIO occurs on the same page, should we cover the case EIO occurs on different pages?Which case are you looking at?
-
__get_node_page(PageA)-__get_node_page(PageB)
-f2fs_handle_page_eio
- sbi->page_eio_ofs[type] =PageA->index
-f2fs_handle_page_eio
- sbi->page_eio_ofs[type] =PageB->index
Quoted 3 lines
Quoted 1 line
In such race case, it may has low probability to set
CP_ERROR_FLAGas we expect?Do you see that case in products?
Not yet.
Quoted 1 line
I'm trying to avoid setting
CP_ERROR_FLAGhere.
Copied, how about using the same logic for node page as meta page, like we did in f2fs_get_meta_page_retry()?
Thanks,
Quoted 32 lines
Quoted 32 lines
Thanks,
Quoted 28 lines
Quoted 28 lines
Thanks,
Quoted 24 lines
Signed-off-by Randall Huang <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>---
Change log from v1:
- fix a bug
fs/f2fs/inode.c| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/inode.c +1
-1@@ -719,7 +719,7 @@ void f2fs_update_inode_page(struct inode *inode)if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { +if (err == -ENOMEM || (err == -EIO && !f2fs_cp_error (sbi))) {cond_resched (); goto retry; }else if (err != -ENOENT ) {
Jaegeuk Kim
maintainerQuoted 22 lines · Chao Yu
Quoted 21 lines · Jaegeuk Kim
Quoted 19 lines · Chao Yu
Quoted 10 lines · Jaegeuk Kim
Quoted 7 lines · Chao Yu
Quoted 3 lines · Jaegeuk Kim
In
f2fs_update_inode_page,f2fs_get_node_pagehandles EIO along withf2fs_handle_page_eiothat stops checkpoint, if the disk couldn't be recovered. As a result, we don't need to stop checkpoint right away given single EIO.
f2fs_handle_page_eio()only covers the case that EIO occurs on the same page, should we cover the case EIO occurs on different pages?Which case are you looking at?
-
__get_node_page(PageA)-__get_node_page(PageB)
-f2fs_handle_page_eio
- sbi->page_eio_ofs[type] =PageA->index
-f2fs_handle_page_eio
- sbi->page_eio_ofs[type] =PageB->indexIn such race case, it may has low probability to set
CP_ERROR_FLAGas we expect?
Quoted 8 lines
Quoted 1 line
Do you see that case in products?
Not yet.
Quoted 1 line
I'm trying to avoid setting
CP_ERROR_FLAGhere.Copied, how about using the same logic for node page as meta page, like we did in
f2fs_get_meta_page_retry()?
Yeah.. let me send v3 and test a bit. Thanks~ :)
Quoted 35 lines
Thanks,
Quoted 32 lines
Quoted 32 lines
Thanks,
Quoted 28 lines
Quoted 28 lines
Thanks,
Quoted 24 lines
Signed-off-by Randall Huang <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>---
Change log from v1:
- fix a bug
fs/f2fs/inode.c| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/inode.c +1
-1@@ -719,7 +719,7 @@ void f2fs_update_inode_page(struct inode *inode)if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { +if (err == -ENOMEM || (err == -EIO && !f2fs_cp_error (sbi))) {cond_resched (); goto retry; }else if (err != -ENOENT ) {
Jaegeuk Kim
maintainerIn f2fs_update_inode_page, f2fs_get_node_page handles EIO along with f2fs_handle_page_eio that stops checkpoint, if the disk couldn't be recovered. As a result, we don't need to stop checkpoint right away given single EIO.
---
Change log from v2:
- set EIO to cover the case of data corruption given by buggy UFS driver
fs/f2fs/inode.c | 2 +- fs/f2fs/node.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/inode.c +1 -1
@@ -719,7 +719,7 @@ void f2fs_update_inode_page(struct inode *inode)if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { +if (err == -ENOMEM || (err == -EIO && !f2fs_cp_error (sbi))) {cond_resched (); goto retry; }else if (err != -ENOENT ) {
fs/f2fs/node.c +1 -1
@@ -1455,7 +1455,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,ofs_of_node (page),cpver_of_node (page), next_blkaddr_of_node(page));set_sbi_flag (sbi,SBI_NEED_FSCK ); - err = -EINVAL ; + err = -EIO ; out_err:ClearPageUptodate (page); out_put_err:
Signature · 8 lines
2.39.0.314.g84b9a713c41-goog _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerIf the storage gives a corrupted node block due to short power failure and reset, f2fs stops the entire operations by setting the checkpoint failure flag.
Let's give more chances to live by re-issuing IOs for a while in such critical path.
---
Change log from v2:
- adopting the retry logic
fs/f2fs/inode.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
fs/f2fs/inode.c +7 -6
@@ -724,18 +724,19 @@ void f2fs_update_inode_page(struct inode *inode) {struct f2fs_sb_info *sbi =F2FS_I_SB (inode);struct page *node_page; +int count =0 ; retry: node_page =f2fs_get_node_page (sbi, inode->i_ino);if (IS_ERR (node_page)) {int err =PTR_ERR (node_page); -if (err == -ENOMEM ) { -cond_resched (); +/* The node block was truncated. */ +if (err == -ENOENT ) +return ; + +if (err == -ENOMEM || ++count <=DEFAULT_RETRY_IO_COUNT ) goto retry; - }else if (err != -ENOENT ) { -f2fs_stop_checkpoint (sbi, false, -STOP_CP_REASON_UPDATE_INODE ); - } +f2fs_stop_checkpoint (sbi, false,STOP_CP_REASON_UPDATE_INODE );return ; }f2fs_update_inode (inode, node_page);
Signature · 1 line
2.39.1.456.gfc5497dd1b-goog
Quoted 10 lines · Jaegeuk Kim
If the storage gives a corrupted node block due to short power failure and reset, f2fs stops the entire operations by setting the checkpoint failure flag.
Let's give more chances to live by re-issuing IOs for a while in such critical path.
Suggested-by Randall Huang <[email protected]>Suggested-by Chao Yu <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>
Thanks,