From: David Sterba <dsterba@suse.cz>
To: dsterba@suse.cz, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 4/6] btrfs: add wrapper for conditional start of exclusive operation
Date: Thu, 27 May 2021 00:24:38 +0200 [thread overview]
Message-ID: <20210526222438.GJ7604@twin.jikos.cz> (raw)
In-Reply-To: <20210521164551.GP7604@twin.jikos.cz>
On Fri, May 21, 2021 at 06:45:51PM +0200, David Sterba wrote:
> On Fri, May 21, 2021 at 09:29:16AM -0400, Josef Bacik wrote:
> > On 5/21/21 8:06 AM, David Sterba wrote:
> > > + /*
> > > + * This blocks any exclop finish from setting it to NONE, so we
> > > + * request cancelation. Either it runs and we will wait for it,
> > > + * or it has finished and no waiting will happen.
> > > + */
> > > + atomic_inc(&fs_info->reloc_cancel_req);
> > > + btrfs_exclop_start_unlock(fs_info);
> > > +
> > > + if (test_bit(BTRFS_FS_RELOC_RUNNING, &fs_info->flags))
> > > + wait_on_bit(&fs_info->flags, BTRFS_FS_RELOC_RUNNING,
> > > + TASK_INTERRUPTIBLE);
> >
> > Do we want to capture the return value here, in case the user hit's ctrl+c we
> > can return -EINTR instead so we don't think it succeeded? Thanks,
>
> The cancel request will stay, so only the waiting part won't happen. I'm
> not sure if this is worth to distinguish the two states, eg. allow progs
> to print a different message.
So as the cancelling would happen I hope it's ok to return the ECANCELED
error in all cases. Other operations like balance or scrub aren't
interruptible and wait until the condition is satisified, but there's a
different pattern regarding the cancel request so it has to be that way
there. This could be unified but right now I don't see the need for
that.
> Maybe a waiting and non-waiting cancel modes would be also useful. As
> the interface is string-based we can also add 'status' that would say if
> it's running or not. This should cover the usecases, but would be
> a bit more complicated in the state transitions.
I've asked on IRC what's the expected behaviour of cancel command
regarding waiting/not waiting. Seems that 'wait until it's finished' is
preferred and it's consistent with what scrub and balance (cancel) do.
next prev parent reply other threads:[~2021-05-26 22:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 12:06 [PATCH 0/6] Support resize and device delete cancel ops David Sterba
2021-05-21 12:06 ` [PATCH 1/6] btrfs: protect exclusive_operation by super_lock David Sterba
2021-05-21 13:37 ` Josef Bacik
2021-05-21 12:06 ` [PATCH 2/6] btrfs: add cancelable chunk relocation support David Sterba
2021-05-21 13:21 ` Josef Bacik
2021-05-26 22:56 ` David Sterba
2021-06-16 13:54 ` Filipe Manana
2021-06-16 13:55 ` Filipe Manana
2021-06-16 15:53 ` David Sterba
2021-06-16 15:58 ` [PATCH v2] btrfs: add cancellable " David Sterba
2021-06-17 9:18 ` Filipe Manana
2021-05-21 12:06 ` [PATCH 3/6] btrfs: introduce try-lock semantics for exclusive op start David Sterba
2021-05-21 13:38 ` Josef Bacik
2021-05-27 7:43 ` Anand Jain
2021-05-28 12:30 ` David Sterba
2021-05-29 13:48 ` Anand Jain
2021-05-31 18:23 ` David Sterba
2021-05-21 12:06 ` [PATCH 4/6] btrfs: add wrapper for conditional start of exclusive operation David Sterba
2021-05-21 13:29 ` Josef Bacik
2021-05-21 16:45 ` David Sterba
2021-05-26 22:24 ` David Sterba [this message]
2021-05-21 12:06 ` [PATCH 5/6] btrfs: add cancelation to resize David Sterba
2021-05-21 13:38 ` Josef Bacik
2021-05-21 12:06 ` [PATCH 6/6] btrfs: add device delete cancel David Sterba
2021-05-21 13:38 ` Josef Bacik
2021-05-21 12:06 ` [PATCH 1/2] btrfs-progs: device remove: add support for cancel David Sterba
2021-05-21 12:06 ` [PATCH 2/2] btrfs-progs: fi resize: " David Sterba
2021-12-14 14:49 ` [PATCH 0/6] Support resize and device delete cancel ops Anand Jain
2021-12-15 15:13 ` David Sterba
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=20210526222438.GJ7604@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--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;
as well as URLs for NNTP newsgroup(s).