From: David Sterba <dsterba@suse.cz>
To: Omar Sandoval <osandov@osandov.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com,
David Sterba <dsterba@suse.com>
Subject: Re: [PATCH v8 4/6] Btrfs: prevent ioctls from interfering with a swap file
Date: Thu, 20 Sep 2018 19:01:57 +0200 [thread overview]
Message-ID: <20180920170157.GB5847@twin.jikos.cz> (raw)
In-Reply-To: <fa7d168bea119d8c2432833c16103eafcf02130f.1537419652.git.osandov@fb.com>
On Wed, Sep 19, 2018 at 10:02:15PM -0700, Omar Sandoval wrote:
> --- a/fs/btrfs/dev-replace.c
> +++ b/fs/btrfs/dev-replace.c
> @@ -414,6 +414,14 @@ int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
> if (ret)
> return ret;
>
> + if (btrfs_pinned_by_swapfile(fs_info, src_device)) {
> + btrfs_info_in_rcu(fs_info,
> + "cannot replace device %s (devid %llu) due to active swapfile",
Please un-indent the messages so they fit under 80 columns, the
arguments can stay aligned as before.
> + btrfs_dev_name(src_device),
> + src_device->devid);
> + return -ETXTBSY;
I think all the error messages before returning ETXTBUSY or EINVAL
should be btrfs_error or btrfs_warning. The info level can be filtered
out and easily lost in the logs. If there's user intention to activate
the swap it needs to be resolved.
> + }
> +
> ret = btrfs_init_dev_replace_tgtdev(fs_info, tgtdev_name,
> src_device, &tgt_device);
> if (ret)
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -3626,10 +3634,15 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
>
> ret = btrfs_relocate_chunk(fs_info, found_key.offset);
> mutex_unlock(&fs_info->delete_unused_bgs_mutex);
> - if (ret && ret != -ENOSPC)
> - goto error;
> if (ret == -ENOSPC) {
> enospc_errors++;
> + } else if (ret == -ETXTBSY) {
> + btrfs_info(fs_info,
> + "skipping relocation of block group %llu due to active swapfile",
I wonder if this should be visible even on the info level, ie. so it
could be debug. The swap file can be long lived, the balance could be
run several times during that period.
> + found_key.offset);
> + ret = 0;
> + } else if (ret) {
> + goto error;
> } else {
> spin_lock(&fs_info->balance_lock);
> bctl->stat.completed++;
next prev parent reply other threads:[~2018-09-20 22:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 5:02 [PATCH v8 0/6] Btrfs: implement swap file support Omar Sandoval
2018-09-20 5:02 ` [PATCH v8 1/6] mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS Omar Sandoval
2018-09-20 5:02 ` [PATCH v8 2/6] mm: export add_swap_extent() Omar Sandoval
2018-09-20 5:02 ` [PATCH v8 3/6] vfs: update swap_{,de}activate documentation Omar Sandoval
2018-09-20 5:02 ` [PATCH v8 4/6] Btrfs: prevent ioctls from interfering with a swap file Omar Sandoval
2018-09-20 17:01 ` David Sterba [this message]
2018-09-20 5:02 ` [PATCH v8 5/6] Btrfs: rename get_chunk_map() and make it non-static Omar Sandoval
2018-09-20 17:05 ` David Sterba
2018-09-20 5:02 ` [PATCH v8 6/6] Btrfs: support swap files Omar Sandoval
2018-09-20 17:15 ` David Sterba
2018-09-20 17:22 ` Omar Sandoval
2018-09-21 15:21 ` David Sterba
2018-09-20 17:22 ` [PATCH v8 0/6] Btrfs: implement swap file support David Sterba
2018-09-20 17:41 ` Omar Sandoval
2018-09-21 15:17 ` David Sterba
2018-09-21 18:29 ` Omar Sandoval
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=20180920170157.GB5847@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=dsterba@suse.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=osandov@osandov.com \
/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).