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>
Fri, 9 Sep 2016 18:09:22 +0000 (11:09 -0700)
commit75cdfd8d45f221e0850dd9276a42c0a2f4a5076c
treec57e2ca9bb05a5d1f3b867ef06961f3f85f6dd11
parent2888f5bf49ede6ddf8f4388a2d4e17dadc5263f5
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
This page took 0.024576 seconds and 5 git commands to generate.