diff options
author | Anand Jain <anand.jain@oracle.com> | 2018-02-13 11:53:43 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-03-26 15:09:34 +0200 |
commit | 8f2ceaa7b42a6df21eed621b88037af2c4cd8257 (patch) | |
tree | 2103d02e2b6b44bac8fe45d5f8428026aed3b90c /fs/btrfs/dev-replace.c | |
parent | acf18c56fdcb952a06650282192e3b4ca1855c5e (diff) | |
download | linux-stable-8f2ceaa7b42a6df21eed621b88037af2c4cd8257.tar.gz linux-stable-8f2ceaa7b42a6df21eed621b88037af2c4cd8257.tar.bz2 linux-stable-8f2ceaa7b42a6df21eed621b88037af2c4cd8257.zip |
btrfs: log, when replace, is canceled by the user
For debugging or administration purposes, we would want to know if and
when the user cancels the replace, to complement the existing messages
when dev-replace starts or finishes.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ update changelog, fold fix for RCU warning from Nikolay ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r-- | fs/btrfs/dev-replace.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index c523478b3de2..e279f04b3388 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,12 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info) } ret = btrfs_commit_transaction(trans); WARN_ON(ret); + + btrfs_info_in_rcu(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); |