[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230520104329.2402182-1-dongyangli@ddn.com>
Date: Sat, 20 May 2023 20:43:29 +1000
From: Li Dongyang <dongyangli@....com>
To: linux-ext4@...r.kernel.org
Cc: adilger@...ger.ca, lczerner@...hat.com
Subject: [PATCH] tune2fs: fall back to old get/set fs label on error
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.
Fixes: f85b4526f ("tune2fs: implement support for set/get label iocts")
Signed-off-by: Li Dongyang <dongyangli@....com>
---
misc/tune2fs.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 458f7cf6a..460d81c9e 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3096,24 +3096,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) {
--
2.39.2
Powered by blists - more mailing lists