]> git.ipfire.org Git - thirdparty/mdadm.git/commit - util.c
mdadm: improve the dlm locking mechanism for clustered raid
authorGuoqing Jiang <gqjiang@suse.com>
Mon, 22 Jan 2018 09:12:08 +0000 (17:12 +0800)
committerJes Sorensen <jsorensen@fb.com>
Thu, 8 Mar 2018 19:16:42 +0000 (14:16 -0500)
commit1b7eb962db2cf9179d097e06cce74b84ac80e49d
treef0fa6b7fe7f88b2d8e9341a2ca4f7349d06471ea
parent9c816fe2ad158b39695339f58ddc921c68453cb1
mdadm: improve the dlm locking mechanism for clustered raid

Previously, the dlm locking only protects several
functions which writes to superblock (update_super,
add_to_super and store_super), and we missed other
funcs such as add_internal_bitmap. We also need to
call the funcs which read superblock under the
locking protection to avoid consistent issue.

So let's remove the dlm stuffs from super1.c, and
provide the locking mechanism to the main() except
assemble mode which will be handled in next commit.
And since we can identify it is a clustered raid or
not based on check the different conditions of each
mode, so the change should not have effect on native
array.

And we improve the existed locking stuffs as follows:

1. replace ls_unlock with ls_unlock_wait since we
should return when unlock operation is complete.

2. inspired by lvm, let's also try to use the existed
lockspace first before creat a lockspace blindly if
the lockspace not released for some reason.

3. try more times before quit if EAGAIN happened for
locking.

Note: for MANAGE mode, we do not need to get lock if
node just want to confirm device change, otherwise we
can't add a disk to cluster since all nodes are compete
for the lock.

Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
mdadm.c
mdadm.h
super1.c
util.c