Whamcloud - gitweb
LU-16835 tune2fs: fall back to old get/set fs label on error 73/51073/2
authorLi Dongyang <dongyangli@ddn.com>
Sat, 20 May 2023 10:26:32 +0000 (20:26 +1000)
committerLi Dongyang <dongyangli@ddn.com>
Thu, 25 May 2023 01:47:43 +0000 (01:47 +0000)
If we fail to get/open the mount point for get/set
fs label ioctl, just fall back to old method and
silence the error messages.

Change-Id: I2ce5c02974540ff0fe883b992d0b510e68f6db26
Fixes: f85b4526f ("tune2fs: implement support for set/get label iocts")
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/tools/e2fsprogs/+/51073
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
misc/tune2fs.c

index e553219..dc9d9d5 100644 (file)
@@ -3122,24 +3122,19 @@ static int handle_fslabel(int setlabel)
 
        ret = ext2fs_check_mount_point(device_name, &mnt_flags,
                                          mntpt, sizeof(mntpt));
-       if (ret) {
-               com_err(device_name, ret, _("while checking mount status"));
-               return 1;
-       }
+       if (ret)
+               return -1;
+
        if (!(mnt_flags & EXT2_MF_MOUNTED) ||
            (setlabel && (mnt_flags & EXT2_MF_READONLY)))
                return -1;
 
-       if (!mntpt[0]) {
-               fprintf(stderr,_("Unknown mount point for %s\n"), device_name);
-               return 1;
-       }
+       if (!mntpt[0])
+               return -1;
 
        fd = open(mntpt, O_RDONLY);
-       if (fd < 0) {
-               com_err(mntpt, errno, _("while opening mount point"));
-               return 1;
-       }
+       if (fd < 0)
+               return -1;
 
        /* Get fs label */
        if (!setlabel) {