Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: "Bernhard Kühnel" <hupf.vger@allchangeplease.de>
To: linux-btrfs@vger.kernel.org
Subject: "btrfs scrub cancel" aborts running replace operation
Date: Fri, 6 Dec 2019 12:31:06 +0100	[thread overview]
Message-ID: <bfec29b7-fd82-d358-02da-c1d3992c0bf4@allchangeplease.de> (raw)

It seems there's a run-time dependency between scrub and replace
operations for which I don't find hints in the documentation.

Steps to reproduce (choosing large-ish file[system] just to ensure the
operations don't finish immediately - I'm not familiar enough with
rate-limiting setup for a more elegant approach):

0. Log software information

# uname -r -m; btrfs version
5.4.1-gentoo x86_64
btrfs-progs v5.4

1. setup a simple multi-device filesystem with one spare and some data

# for i in {1..3}; do truncate -s 512G loop$i; losetup /dev/loop$i
loop$i; done
# mkfs.btrfs -m raid1 -d raid0 /dev/loop{1..2}
# mkdir /mnt/test && mount /dev/loop1 /mnt/test
# dd if=/dev/urandom of=/mnt/test/somedata bs=1M count=65536

2. replace one device with the spare

# btrfs scrub status /mnt/test/; btrfs replace start /dev/loop2
/dev/loop3 /mnt/test/; sleep 1; btrfs scrub status /mnt/test/; btrfs
replace status -1 /mnt/test; btrfs scrub cancel /mnt/test/; sleep 1;
btrfs replace status /mnt/test

output from step 2:

UUID:             eafe3cb7-7ea1-405d-98a9-9dfffee2ea9d
        no stats available
Total to scrub:   64.15GiB
Rate:             0.00B/s
Error summary:    no errors found
UUID:             eafe3cb7-7ea1-405d-98a9-9dfffee2ea9d
        no stats available
Time left:        0:00:00
ETA:              Fri Dec  6 12:10:03 2019
Total to scrub:   64.15GiB
Bytes scrubbed:   0.00B
Rate:             0.00B/s
Error summary:    no errors found
0.1% done, 0 write errs, 0 uncorr. read errs
scrub cancelled
Started on  6.Dec 12:10:02, canceled on  6.Dec 12:10:06 at 0.0%, 0 write
errs, 0 uncorr. read errs


Observations: Prior to starting replace, no scrub is running.
Immediately after issuing replace statement, btrfs scrub status reports
a running scrub operation. After issuing btrfs scrub cancel, the replace
operations is being cancelled instead.


Expectation: As "btrfs scrub cancel" might be issued as part of other
maintenance jobs, it should not affect a replace operation in progress. 
Would it be possible to separate the two operations w.r.t. userspace
tools? Alternatively, should this behaviour be documented?



Regards


Bernhard Kühnel



                 reply	other threads:[~2019-12-06 11:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfec29b7-fd82-d358-02da-c1d3992c0bf4@allchangeplease.de \
    --to=hupf.vger@allchangeplease.de \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox