For convenient, paste the patch here: 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' */ ----- Original Message ----- > From: "Xiao Ni" <xni@xxxxxxxxxx> > To: "linux-raid" <linux-raid@xxxxxxxxxxxxxxx> > Cc: "Heinz Mauelshagen" <heinzm@xxxxxxxxxx>, "Nigel Croxon" <ncroxon@xxxxxxxxxx> > Sent: Friday, October 30, 2020 8:38:16 PM > Subject: The raid device can't be unmount when it can't work > > 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 >