]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/md/md.h
md: changes for MD_STILL_CLOSED flag
authorGuoqing Jiang <gqjiang@suse.com>
Fri, 12 Aug 2016 05:42:37 +0000 (13:42 +0800)
committerShaohua Li <shli@fb.com>
Wed, 21 Sep 2016 16:09:44 +0000 (09:09 -0700)
commitaf8d8e6f031589ccf32b08eea91def53db8cfa95
tree8886cf9729818c51bec074df32d53ce61244a69d
parente3f924d3dfc672dd1292bc7eb6f2a305c13981ec
md: changes for MD_STILL_CLOSED flag

When stop clustered raid while it is pending on resync,
MD_STILL_CLOSED flag could be cleared since udev rule
is triggered to open the mddev. So obviously array can't
be stopped soon and returns EBUSY.

mdadm -Ss          md-raid-arrays.rules
  set MD_STILL_CLOSED          md_open()
... ... ...          clear MD_STILL_CLOSED
do_md_stop

We make below changes to resolve this issue:

1. rename MD_STILL_CLOSED to MD_CLOSING since it is set
   when stop array and it means we are stopping array.
2. let md_open returns early if CLOSING is set, so no
   other threads will open array if one thread is trying
   to close it.
3. no need to clear CLOSING bit in md_open because 1 has
   ensure the bit is cleared, then we also don't need to
   test CLOSING bit in do_md_stop.

Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/md.c
drivers/md/md.h