All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: set scrub page's io_error if failing to submit io
@ 2017-03-24 23:48 Liu Bo
  2017-03-27 17:12 ` David Sterba
  2017-03-29 17:55 ` [PATCH v2] " Liu Bo
  0 siblings, 2 replies; 4+ messages in thread
From: Liu Bo @ 2017-03-24 23:48 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Otherwise, we may later skip this page when repairing bad copy from
good copy.

Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/scrub.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index b0251eb..026c2b8 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1497,14 +1497,18 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info,
 
 		bio_add_page(bio, page->page, PAGE_SIZE, 0);
 		if (!retry_failed_mirror && scrub_is_page_on_raid56(page)) {
-			if (scrub_submit_raid56_bio_wait(fs_info, bio, page))
+			if (scrub_submit_raid56_bio_wait(fs_info, bio, page)) {
+				page->io_error = 1;
 				sblock->no_io_error_seen = 0;
+			}
 		} else {
 			bio->bi_iter.bi_sector = page->physical >> 9;
 			bio_set_op_attrs(bio, REQ_OP_READ, 0);
 
-			if (btrfsic_submit_bio_wait(bio))
+			if (btrfsic_submit_bio_wait(bio)) {
+				page->io_error = 1;
 				sblock->no_io_error_seen = 0;
+			}
 		}
 
 		bio_put(bio);
-- 
2.5.5


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

* Re: [PATCH] Btrfs: set scrub page's io_error if failing to submit io
  2017-03-24 23:48 [PATCH] Btrfs: set scrub page's io_error if failing to submit io Liu Bo
@ 2017-03-27 17:12 ` David Sterba
  2017-03-29 17:55 ` [PATCH v2] " Liu Bo
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2017-03-27 17:12 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs, David Sterba

On Fri, Mar 24, 2017 at 04:48:00PM -0700, Liu Bo wrote:
> Otherwise, we may later skip this page when repairing bad copy from
> good copy.

Can you please enhance the changelog? At least some more pointers what
and where it could go wrong if the value is not set properly, to get the
rough idea. Thanks.

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

* [PATCH v2] Btrfs: set scrub page's io_error if failing to submit io
  2017-03-24 23:48 [PATCH] Btrfs: set scrub page's io_error if failing to submit io Liu Bo
  2017-03-27 17:12 ` David Sterba
@ 2017-03-29 17:55 ` Liu Bo
  2017-03-29 20:55   ` David Sterba
  1 sibling, 1 reply; 4+ messages in thread
From: Liu Bo @ 2017-03-29 17:55 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Scrub repairs data by the unit called scrub_block, which may contains
several pages.  Scrub always tries to look up a good copy of a whole
block, but if there's no such copy, it tries to do repair page by page.

If we don't set page's io_error when checking this bad copy, in the last
step, we may skip this page when repairing bad copy from good copy.

Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: Put more details in changelog.

 fs/btrfs/scrub.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index b0251eb..026c2b8 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1497,14 +1497,18 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info,
 
 		bio_add_page(bio, page->page, PAGE_SIZE, 0);
 		if (!retry_failed_mirror && scrub_is_page_on_raid56(page)) {
-			if (scrub_submit_raid56_bio_wait(fs_info, bio, page))
+			if (scrub_submit_raid56_bio_wait(fs_info, bio, page)) {
+				page->io_error = 1;
 				sblock->no_io_error_seen = 0;
+			}
 		} else {
 			bio->bi_iter.bi_sector = page->physical >> 9;
 			bio_set_op_attrs(bio, REQ_OP_READ, 0);
 
-			if (btrfsic_submit_bio_wait(bio))
+			if (btrfsic_submit_bio_wait(bio)) {
+				page->io_error = 1;
 				sblock->no_io_error_seen = 0;
+			}
 		}
 
 		bio_put(bio);
-- 
2.5.5


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

* Re: [PATCH v2] Btrfs: set scrub page's io_error if failing to submit io
  2017-03-29 17:55 ` [PATCH v2] " Liu Bo
@ 2017-03-29 20:55   ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2017-03-29 20:55 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs, David Sterba

On Wed, Mar 29, 2017 at 10:55:16AM -0700, Liu Bo wrote:
> Scrub repairs data by the unit called scrub_block, which may contains
> several pages.  Scrub always tries to look up a good copy of a whole
> block, but if there's no such copy, it tries to do repair page by page.
> 
> If we don't set page's io_error when checking this bad copy, in the last
> step, we may skip this page when repairing bad copy from good copy.

Great, thanks.

> Cc: David Sterba <dsterba@suse.cz>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>

Reviewed-by: David Sterba <dsterba@suse.com>

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

end of thread, other threads:[~2017-03-29 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 23:48 [PATCH] Btrfs: set scrub page's io_error if failing to submit io Liu Bo
2017-03-27 17:12 ` David Sterba
2017-03-29 17:55 ` [PATCH v2] " Liu Bo
2017-03-29 20:55   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.