From 51a40f6df01ea7e0673bd1b50a0d28e1def345f2 Mon Sep 17 00:00:00 2001 From: Gui Hecheng Date: Thu, 20 Feb 2014 10:49:03 +0800 Subject: btrfs-progs: judge the return value of check_mounted more accurately For btrfs-convert, btrfstune, btrfs rescue, they report "device busy" when given a device that does not actually exist e.g. # btrfstune -x abcdefg (this device does not exist) $ ...device busy... We deal with this case by add "ret < 0" error check when judging the return value of check_mounted. Signed-off-by: Gui Hecheng Signed-off-by: David Sterba Signed-off-by: Chris Mason --- btrfstune.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'btrfstune.c') diff --git a/btrfstune.c b/btrfstune.c index 855427fa..2c26fe9b 100644 --- a/btrfstune.c +++ b/btrfstune.c @@ -151,7 +151,12 @@ int main(int argc, char *argv[]) return 1; } - if (check_mounted(device)) { + ret = check_mounted(device); + if (ret < 0) { + fprintf(stderr, "Could not check mount status: %s\n", + strerror(-ret)); + return 1; + } else if (ret) { fprintf(stderr, "%s is mounted\n", device); return 1; } -- cgit v1.2.3