Linux-BTRFS Archive on lore.kernel.org
 help / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report
Date: Wed, 16 Jan 2019 11:13:26 +0800
Message-ID: <1547608406-6430-2-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1547608406-6430-1-git-send-email-anand.jain@oracle.com>

Replace start fails to report the appropriate error if balance is already
running, as below,

btrfs rep start -B -f /dev/sdb /dev/sde /btrfs
ERROR: ioctl(DEV_REPLACE_START) on '/btrfs' returns error: <illegal
result value>

Fix it by checking if the return is > 0, as the kernel returns
BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS for the above cli, if the balance is
running.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
---
 cmds-replace.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmds-replace.c b/cmds-replace.c
index 42de4de8c031..696f24c5c6d5 100644
--- a/cmds-replace.c
+++ b/cmds-replace.c
@@ -295,6 +295,10 @@ static int cmd_replace_start(int argc, char **argv)
 			goto leave_with_error;
 		}
 
+		if (ret > 0)
+			error("ioctl(DEV_REPLACE_START) '%s': %s", path,
+			      btrfs_err_str(ret));
+
 		if (start_args.result !=
 		    BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT &&
 		    start_args.result !=
-- 
1.8.3.1


  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16  3:13 [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
2019-01-16  3:13 ` Anand Jain [this message]
2019-01-25 11:21 ` Anand Jain
  -- strict thread matches above, loose matches on Subject: below --
2019-02-22 17:43 Anand Jain
2019-02-22 17:43 ` [PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report Anand Jain
2019-01-31 10:05 [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
2019-01-31 10:05 ` [PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report Anand Jain
2019-01-08  4:09 [PATCH RESEND 1/2] btrfs-progs: check for no result before using results Anand Jain
2019-01-08  4:09 ` [PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report Anand Jain

Reply instructions:

You may reply publically 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=1547608406-6430-2-git-send-email-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

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org linux-btrfs@archiver.kernel.org
	public-inbox-index linux-btrfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox