linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Ni <xni@redhat.com>
To: linux-raid <linux-raid@vger.kernel.org>
Cc: Heinz Mauelshagen <heinzm@redhat.com>, Nigel Croxon <ncroxon@redhat.com>
Subject: Re: The raid device can't be unmount when it can't work
Date: Fri, 30 Oct 2020 20:49:16 -0400 (EDT)	[thread overview]
Message-ID: <505084787.23972105.1604105356558.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <9b6db7d5-4a34-a1f9-2314-5e3522555052@redhat.com>

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@redhat.com>
> To: "linux-raid" <linux-raid@vger.kernel.org>
> Cc: "Heinz Mauelshagen" <heinzm@redhat.com>, "Nigel Croxon" <ncroxon@redhat.com>
> 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
> 


  reply	other threads:[~2020-10-31  0:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-11-02 20:11 ` Phillip Susi
2020-11-04  2:42   ` Xiao Ni
2020-11-04  2:51     ` Xiao Ni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=505084787.23972105.1604105356558.JavaMail.zimbra@redhat.com \
    --to=xni@redhat.com \
    --cc=heinzm@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=ncroxon@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).