On 3/22/23 03:11, Mariusz Tkaczyk wrote: > On Mon, 20 Mar 2023 19:01:01 -0700 > Marc MERLIN <marc@xxxxxxxxxxx> wrote: > >> On Mon, Mar 20, 2023 at 04:16:59PM +0100, Mariusz Tkaczyk wrote: >>> On Mon, 20 Mar 2023 07:50:35 -0700 >>> Marc MERLIN <marc@xxxxxxxxxxx> wrote: >>> >>>> On Mon, Mar 20, 2023 at 03:36:39PM +0100, Mariusz Tkaczyk wrote: >>>>> Hi, >>>>> mdadm is unable to complete this task because it cannot ensure that it >>>>> is safe to stop the array. It cannot open the array with O_EXCL. >>>>> If it is mounted then it may hang if filesystem needs to flush some >>>>> data. >>>> >>>> Thanks for the reply. The array was not mounted, that said, given that >>>> it was fully down, there wasn't a way to flush the data if it had been >>>> (cable problem to an enclosure, all the drives disappeared at once) >>>> >>>>> Please, try umount the array if it mounted somewhere and then try: >>>>> >>>>> # echo inactive > /sys/block/md6/md/array_state >>>>> # echo clear > /sys/block/md6/md/array_state >>>> >>>> I can try this next time (already had to reboot), thanks. >>>> >>>> That said, mdadm should output a better message in this case >>>>>> mdadm: /dev/md6 does not appear to be an md device >>>> is clearly wrong >>>> >>>> Is that something easy to fix/improve? >>> >>> Oh, sorry my bad, please see the code: >>> https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/mdopen.c#n472 >>> >>> We are failing to "understand" the array: >>> https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/util.c#n229 >>> It has nothing to do with open and O_EXCL. I didn't dig into to determine >>> why. >>> >>> Anyway, now error seems to be reasonable but maybe we should be able to >>> tract this array as valid? I requires more work and analysis so it is not >>> simple fix. >> >> You are definitely more knowledgeable about this than I am. >> All I can say is that the array was down, not mounted, and I couldn't >> stop it without a reboot, and that's a problem. >> >> Any way to force stop in a case like this, would be quite welcome :) >> >> Thanks, >> Marc > > Jes, how you see this? If we can force stop it with a big fat warning, then I think that would be a good feature to add. The must reboot requirement is not exactly ideal. Cheers, Jes