linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* The raid device can't be unmount when it can't work
@ 2020-10-30 12:38 Xiao Ni
  2020-10-31  0:49 ` Xiao Ni
  2020-11-02 20:11 ` Phillip Susi
  0 siblings, 2 replies; 5+ messages in thread
From: Xiao Ni @ 2020-10-30 12:38 UTC (permalink / raw)
  To: linux-raid; +Cc: Heinz Mauelshagen, Nigel Croxon

[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]

Hi all

When one raid loses disks that are bigger than the max degraded number, 
the udev rule[1] tries to stop
the raid device. If the raid device is mount, it tries to unmount it 
first[2]. It uses udisks command to do this.
It's a little old. Now the package version is udisks2 which uses 
udisksctl to do this. I write a patch[3] and do
test. It's failed because of "udisksctl error Permission denied".

The first test:
[root@localhost ~]# mdadm -CR /dev/md0 -l5 -n3 /dev/sdg /dev/sdi 
/dev/sdj --assume-clean
[root@localhost ~]# mkfs.xfs /dev/md0
[root@localhost ~]# mount /dev/md0 /mnt/test/
[root@localhost ~]# mdadm -If sdg
mdadm: set sdg faulty in md0
mdadm: hot removed sdg from md0
[root@localhost ~]# mdadm -If sdi
mdadm: set device faulty failed for sdi:  Device or resource busy
Unmounted /dev/md0.

The patch works as expected.

The second test:
[root@localhost ~]# mdadm -CR /dev/md0 -l5 -n3 /dev/sdg /dev/sdi 
/dev/sdj --assume-clean
[root@localhost ~]# mkfs.xfs /dev/md0
[root@localhost ~]# mount /dev/md0 /mnt/test/
[root@localhost ~]# echo "scsi remove-single-device 6 0 0 0" > 
/proc/scsi/scsi
[root@localhost ~]# echo "scsi remove-single-device 7 0 0 0" > 
/proc/scsi/scsi
The /dev/md0 is still mount. The patch doesn't work as expected. Logs 
are added during the test. It reports
error "udisksctl error Permission denied"

I searched in google to find the reason. It says it needs to config 
polkit[4]. I did but it didn't work.

The patch is in the attachment
[1]: udev-md-raid-assembly.rules
[2]: IncrementalRemove->force_remove
[3]: The patch is in the attachment
[4]: https://github.com/coldfix/udiskie/wiki/Permissions

Best Regards
Xiao

[-- Attachment #2: 0001-change-udisks-to-udisksctl.patch --]
[-- Type: text/x-patch, Size: 1259 bytes --]

From 0e5b3833da9ba3b663224daf91eb67e8b55a31c4 Mon Sep 17 00:00:00 2001
From: Xiao Ni <xni@redhat.com>
Date: Mon, 26 Oct 2020 23:21:10 +0800
Subject: [PATCH 1/1] mdadm/Incremental: change udisks to udisksctl

Signed-off-by: Xiao Ni <xni@redhat.com>
---
 Incremental.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Incremental.c b/Incremental.c
index 98dbcd9..64c9b48 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -1679,8 +1679,8 @@ static void run_udisks(char *arg1, char *arg2)
 	int pid = fork();
 	int status;
 	if (pid == 0) {
-		execl("/usr/bin/udisks", "udisks", arg1, arg2, NULL);
-		execl("/bin/udisks", "udisks", arg1, arg2, NULL);
+		execl("/usr/bin/udisksctl", "udisksctl", arg1, "-b", arg2, NULL);
+		execl("/bin/udisksctl", "udisksctl", arg1, "-b", arg2, NULL);
 		exit(1);
 	}
 	while (pid > 0 && wait(&status) != pid)
@@ -1692,7 +1692,7 @@ static int force_remove(char *devnm, int fd, struct mdinfo *mdi, int verbose)
 	int rv;
 	int devid = devnm2devid(devnm);
 
-	run_udisks("--unmount", map_dev(major(devid), minor(devid), 0));
+	run_udisks("unmount", map_dev(major(devid), minor(devid), 0));
 	rv = Manage_stop(devnm, fd, verbose, 1);
 	if (rv) {
 		/* At least we can try to trigger a 'remove' */
-- 
2.7.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-04  2:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-30 12:38 The raid device can't be unmount when it can't work Xiao Ni
2020-10-31  0:49 ` Xiao Ni
2020-11-02 20:11 ` Phillip Susi
2020-11-04  2:42   ` Xiao Ni
2020-11-04  2:51     ` Xiao Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).