Whamcloud - gitweb
LU-11047 mdt: standardize mdt object locking
* object LOOKUP lock should be taken from parent MDT if object and
its parent are located on different MDTs, but current mdt object
locking doesn't handle this explicitly, instead it implies its
parent is on local MDT.
* PDO locking should be put into a separate function.
* with the above changes, mdt_object_lock_internal() becomes a simple
wrapper: it calls mdt_remote_object_lock_try() if object is remote,
and mdt_fid_lock() otherwise.
* the MDT object locking functions are as below:
. mdt_object_lock(): lock object, this is used in most places, and
normally lock ibits doesn't contain LOOKUP, unless the caller
knows its parent is on the same MDT.
. mdt_object_check_lock(): lock object with LOOKUP and other
ibits, it needs to check whether parent is on different MDT,
if so, take LOOKUP lock on parent MDT, and then lock other
ibits on child MDT.
. mdt_parent_lock(): take parent UPDATE lock with specific mode,
if parent is local, take PDO lock, otherwise take regular
lock.
. mdt_object_stripes_lock(): lock object which should be local,
and if it's a striped directory, lock its stripes. This is
called in operations which modify dir object and its stripes.
. mdt_object_lock_try(): lock object with trybits, the trybits
contains optional inode lock bits that can be granted. This is
called by getattr/open to fetch more inode lock bits to
client, and is also called by dir migration to lock link
parent in non-block mode to avoid deadlock.
. rename/migrate source object are locked in specific functions,
because source object and its parent may be located on
different remote MDTs.
Test-Parameters: mdscount=2 mdtcount=4 testlist=racer,racer,racer
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I8225cbee4a1f5db8f77399866061f12e0a4cbb47
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/40764
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>