All of lore.kernel.org
 help / color / mirror / Atom feed
* One failed raid device can't umount automatically
@ 2021-01-12  8:42 Xiao Ni
  2021-02-01 14:35 ` Xiao Ni
  0 siblings, 1 reply; 3+ messages in thread
From: Xiao Ni @ 2021-01-12  8:42 UTC (permalink / raw)
  To: linux-raid

Hi all

We support to umount one failed raid device automatically. But it can't 
work now.
For example, one 3 disks raid5 device /dev/md0. I unplug two disks one 
by one.
The udev rule udev-md-raid-assembly.rules is triggered when unplug disk.

In this udev rule, it calls `mdadm -If $disk` when unplug one disk. 
Function IncrementalRemove
is called. When the raid doesn't have enough disks to be active, it 
tries to stop the array.
Before stopping the array, it tries to umount the raid device first.

Now it uses udisks to umount raid device. I printed logs during test. It 
gives error message
"Permission denied". Then I tried with umount directly, it failed with 
the same error message.

diff --git a/Incremental.c b/Incremental.c
index e849bdd..96ba234 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -1620,6 +1620,7 @@ static void run_udisks(char *arg1, char *arg2)
                 manage_fork_fds(1);
                 execl("/usr/bin/udisks", "udisks", arg1, arg2, NULL);
                 execl("/bin/udisks", "udisks", arg1, arg2, NULL);
+               execl("/usr/bin/umount", "umount", arg2, NULL);
                 exit(1);
         }
         while (pid > 0 && wait(&status) != pid)

Does anyone know how to fix this problem?

Regards
Xiao


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

* Re: One failed raid device can't umount automatically
  2021-01-12  8:42 One failed raid device can't umount automatically Xiao Ni
@ 2021-02-01 14:35 ` Xiao Ni
  2021-02-04  8:25   ` Tkaczyk, Mariusz
  0 siblings, 1 reply; 3+ messages in thread
From: Xiao Ni @ 2021-02-01 14:35 UTC (permalink / raw)
  To: linux-raid, artur.paszkiewicz, Jes Sorensen, NeilBrown, Nigel Croxon

Hi all

Any good suggestion for this problem?

Regards
Xiao

On 01/12/2021 04:42 PM, Xiao Ni wrote:
> Hi all
>
> We support to umount one failed raid device automatically. But it 
> can't work now.
> For example, one 3 disks raid5 device /dev/md0. I unplug two disks one 
> by one.
> The udev rule udev-md-raid-assembly.rules is triggered when unplug disk.
>
> In this udev rule, it calls `mdadm -If $disk` when unplug one disk. 
> Function IncrementalRemove
> is called. When the raid doesn't have enough disks to be active, it 
> tries to stop the array.
> Before stopping the array, it tries to umount the raid device first.
>
> Now it uses udisks to umount raid device. I printed logs during test. 
> It gives error message
> "Permission denied". Then I tried with umount directly, it failed with 
> the same error message.
>
> diff --git a/Incremental.c b/Incremental.c
> index e849bdd..96ba234 100644
> --- a/Incremental.c
> +++ b/Incremental.c
> @@ -1620,6 +1620,7 @@ static void run_udisks(char *arg1, char *arg2)
>                 manage_fork_fds(1);
>                 execl("/usr/bin/udisks", "udisks", arg1, arg2, NULL);
>                 execl("/bin/udisks", "udisks", arg1, arg2, NULL);
> +               execl("/usr/bin/umount", "umount", arg2, NULL);
>                 exit(1);
>         }
>         while (pid > 0 && wait(&status) != pid)
>
> Does anyone know how to fix this problem?
>
> Regards
> Xiao
>


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

* Re: One failed raid device can't umount automatically
  2021-02-01 14:35 ` Xiao Ni
@ 2021-02-04  8:25   ` Tkaczyk, Mariusz
  0 siblings, 0 replies; 3+ messages in thread
From: Tkaczyk, Mariusz @ 2021-02-04  8:25 UTC (permalink / raw)
  To: Xiao Ni, linux-raid, artur.paszkiewicz, Jes Sorensen, NeilBrown,
	Nigel Croxon

On 01.02.2021 15:35, Xiao Ni wrote:
> Hi all
Hi Xiao,
> 
> Any good suggestion for this problem?
> 
Replacing udisk by umount won't work from udev context. Umount gets
perrmision denied. You should ask systemd developers to find out
udev friendly way for stopping from udev context. If it is not possible,
in my opinion we should drop this functionality.

> Regards
> Xiao
> 
> On 01/12/2021 04:42 PM, Xiao Ni wrote:
>> Hi all
>>
>> We support to umount one failed raid device automatically. But it can't work now.
>> For example, one 3 disks raid5 device /dev/md0. I unplug two disks one by one.
>> The udev rule udev-md-raid-assembly.rules is triggered when unplug disk.
>>
>> In this udev rule, it calls `mdadm -If $disk` when unplug one disk. Function 
>> IncrementalRemove
>> is called. When the raid doesn't have enough disks to be active, it tries to 
>> stop the array.
>> Before stopping the array, it tries to umount the raid device first.
>>
>> Now it uses udisks to umount raid device. I printed logs during test. It gives 
>> error message
>> "Permission denied". Then I tried with umount directly, it failed with the 
>> same error message.
>>
>> diff --git a/Incremental.c b/Incremental.c
>> index e849bdd..96ba234 100644
>> --- a/Incremental.c
>> +++ b/Incremental.c
>> @@ -1620,6 +1620,7 @@ static void run_udisks(char *arg1, char *arg2)
>>                 manage_fork_fds(1);
>>                 execl("/usr/bin/udisks", "udisks", arg1, arg2, NULL);
>>                 execl("/bin/udisks", "udisks", arg1, arg2, NULL);
>> +               execl("/usr/bin/umount", "umount", arg2, NULL);
>>                 exit(1);
>>         }
>>         while (pid > 0 && wait(&status) != pid)
>>
>> Does anyone know how to fix this problem?
>>
>> Regards
>> Xiao
>>
>
Thanks,
Mariusz

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

end of thread, other threads:[~2021-02-04  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12  8:42 One failed raid device can't umount automatically Xiao Ni
2021-02-01 14:35 ` Xiao Ni
2021-02-04  8:25   ` Tkaczyk, Mariusz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.