From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2] btrfs: log, when replace, is canceled by the user
Date: Tue, 13 Feb 2018 11:53:43 +0800 [thread overview]
Message-ID: <20180213035343.18128-1-anand.jain@oracle.com> (raw)
In-Reply-To: <20180212153658.19631-1-anand.jain@oracle.com>
For forensic investigations of issues, we would want to know
if and when the user cancels the replace.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v1->v2: use btrfs_dev_name() instead of rcu_str_deref()
as btrfs_dev_name() also provides "missing" string,
if needed.
fs/btrfs/dev-replace.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index dd717e204b5e..3b0760f7ec8a 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -703,6 +703,7 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
{
struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace;
struct btrfs_device *tgt_device = NULL;
+ struct btrfs_device *src_device = NULL;
struct btrfs_trans_handle *trans;
struct btrfs_root *root = fs_info->tree_root;
int result;
@@ -724,6 +725,7 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED:
result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR;
tgt_device = dev_replace->tgtdev;
+ src_device = dev_replace->srcdev;
dev_replace->tgtdev = NULL;
dev_replace->srcdev = NULL;
break;
@@ -741,6 +743,11 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
}
ret = btrfs_commit_transaction(trans);
WARN_ON(ret);
+
+ btrfs_info(fs_info, "dev_replace from %s (devid %llu) to %s canceled",
+ btrfs_dev_name(src_device), src_device->devid,
+ btrfs_dev_name(tgt_device));
+
if (tgt_device)
btrfs_destroy_dev_replace_tgtdev(fs_info, tgt_device);
--
2.15.0
next prev parent reply other threads:[~2018-02-13 3:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 15:36 [PATCH 1/1] btrfs: log, when replace, is canceled by the user Anand Jain
2018-02-13 1:47 ` Qu Wenruo
2018-02-13 3:50 ` Anand Jain
2018-02-13 3:53 ` Anand Jain [this message]
2018-02-13 9:05 ` [PATCH v2] " Qu Wenruo
2018-02-13 9:08 ` Nikolay Borisov
2018-02-13 9:10 ` Qu Wenruo
2018-02-13 17:04 ` 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=20180213035343.18128-1-anand.jain@oracle.com \
--to=anand.jain@oracle.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).