* [PATCH] btrfs: Reset IO error counters before start of device replacing
@ 2016-03-29 21:17 Yauhen Kharuzhy
2016-03-31 16:45 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Yauhen Kharuzhy @ 2016-03-29 21:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: Yauhen Kharuzhy
If device replace entry was found on disk at mounting and its num_write_errors
stats counter has non-NULL value, then replace operation will never be
finished and -EIO error will be reported by btrfs_scrub_dev() because
this counter is never reset.
# mount -o degraded /media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/
# btrfs replace status /media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/
Started on 25.Mar 07:28:00, canceled on 25.Mar 07:28:01 at 0.0%, 40 write errs, 0 uncorr. read errs
# btrfs replace start -B 4 /dev/sdg /media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/
ERROR: ioctl(DEV_REPLACE_START) failed on "/media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/": Input/output error, no error
Reset num_write_errors and num_uncorrectable_read_errors counters in the
dev_replace structure before start of replacing.
Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
---
fs/btrfs/dev-replace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 08d629d..94b12d1 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -394,6 +394,8 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
dev_replace->cursor_right = 0;
dev_replace->is_valid = 1;
dev_replace->item_needs_writeback = 1;
+ atomic64_set(&dev_replace->num_write_errors, 0);
+ atomic64_set(&dev_replace->num_uncorrectable_read_errors, 0);
args->result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR;
btrfs_dev_replace_unlock(dev_replace, 1);
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: Reset IO error counters before start of device replacing
2016-03-29 21:17 [PATCH] btrfs: Reset IO error counters before start of device replacing Yauhen Kharuzhy
@ 2016-03-31 16:45 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2016-03-31 16:45 UTC (permalink / raw)
To: Yauhen Kharuzhy; +Cc: linux-btrfs
On Tue, Mar 29, 2016 at 02:17:48PM -0700, Yauhen Kharuzhy wrote:
> If device replace entry was found on disk at mounting and its num_write_errors
> stats counter has non-NULL value, then replace operation will never be
> finished and -EIO error will be reported by btrfs_scrub_dev() because
> this counter is never reset.
>
> # mount -o degraded /media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/
> # btrfs replace status /media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/
> Started on 25.Mar 07:28:00, canceled on 25.Mar 07:28:01 at 0.0%, 40 write errs, 0 uncorr. read errs
> # btrfs replace start -B 4 /dev/sdg /media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/
> ERROR: ioctl(DEV_REPLACE_START) failed on "/media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/": Input/output error, no error
>
> Reset num_write_errors and num_uncorrectable_read_errors counters in the
> dev_replace structure before start of replacing.
>
> Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-31 16:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-29 21:17 [PATCH] btrfs: Reset IO error counters before start of device replacing Yauhen Kharuzhy
2016-03-31 16:45 ` David Sterba
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).