Re: The raid device can't be unmount when it can't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 11/04/2020 10:42 AM, Xiao Ni wrote:


On 11/03/2020 04:11 AM, Phillip Susi wrote:
Xiao Ni writes:

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
Why?  If there are open files on it, you won't be able to unmount it
anyway, and what would you gain by stopping the broken device?
Hi Phillip

This policy was introduced by this patch:

commit 8af530b07fce27f56c56b2ffd254a40b4ab67c6b
Author: NeilBrown <neilb@xxxxxxx>
Date:   Tue Mar 5 09:46:34 2013 +1100

    Enhance incremental removal.

    When asked to incrementally-remove a device, try marking the array
    read-auto first.  That will delay recording the failure in the
    metadata until it is really relevant.
    This way, if the device are just unplugged when the array is not
    really in use, the metadata will remain clean.

    If marking the default as faulty fails because it is EBUSY, that
    implies that the array would be failed without the device.  As the
    device has (presumably gone) - that means the array is dead. So try
    to stop it.  If that fails because it is in use, send a uevent to
report that it is gone. Hopefully whoever mounted it will now let go.

    This means that if  you plug in some devices and they are
    auto-assembled, then unplugging them will auto-deassemble relatively
    cleanly.

    To be complete, we really need the kernel to disassemble the array
after the last close somehow. Maybe if a REMOVE has failed and a STOP
    has failed and nothing else much has happened, it could safely stop
    the array on last close.

And this patch:
commit 6b63c1a4570412c06a40ffa57d35577816259a94
Author: NeilBrown <neilb@xxxxxxx>
Date:   Mon May 13 12:07:40 2013 +1000

    Incrmental: tell udevs to unmount when array looks to have disappeared.

    If a device is removed which appears to be busy in an md array, then
    it is very like the array cannot be used.
    We currently try to stop it, but that could fail if udisks had
    automatically mounted it.
    So tell udisks to unmount it, but ignore any error.



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".
Udisks is a GNOME desktop component, and so may not even exist on many
systems.  When it does, you still can't call it from udev scripts since
they are not run within the desktop in the context of a logged in user.
If you want to unmount the device, just use umount.

Thanks for sharing the knowledge.

Regards
Xiao





[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux