Thread (14 messages) 14 messages, 4 authors, 2023-03-20

Re: [QUESTION] How to fix the race of "mdadm --add" and "mdadm mdadm --incremental --export"

From: Li Xiao Keng <hidden>
Date: 2023-03-15 02:25:35


On 2023/3/15 0:40, Coly Li wrote:
quoted
2023年3月14日 22:58,Li Xiao Keng [off-list ref] 写道:

Hi,
  Here we meet a question. When we add a new disk to a raid, it may return
-EBUSY.
  The main process of --add(for example md0, sdf):
      1.dev_open(sdf)
      2.add_to_super
      3.write_init_super
      4.fsync(fd)
      5.close(fd)
      6.ioctl(ADD_NEW_DISK).
  However, there will be some udev(change of sdf) event after step5. Then
"/usr/sbin/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}"
will be run, and the sdf will be added to md0. After that, step6 will return
-EBUSY.
  It is a problem to user. First time adding disk does not return success
but disk is actually added. And I have no good idea to deal with it. Please
give some great advice.
BTW, may I ask what is the mdadm version used in the above scenario?
The mdadm version is 4.1. After read the newest upstream code, I think
the problem also exists.
Thanks.

Coly Li

.
Regards
Li Xiao Keng
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help