Whamcloud - gitweb
LU-15491 mdt: rename lock inversion deadlock 52/46352/8
authorOleg Drokin <green@whamcloud.com>
Fri, 21 Jun 2024 04:43:37 +0000 (12:43 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 13 Jul 2024 20:50:25 +0000 (20:50 +0000)
commit66194d4e4038fdbbb0eb41cb6e3370bf1f1f030d
tree5b72cf19151255f293bad76d5d1fc6995fea8a4f
parent72cc77e642d6cb696532f3c902680ac04340aa08
LU-15491 mdt: rename lock inversion deadlock

MDT rewrite got rid of lock ordering by fid and replaced it
with parent/child ordering, but child to child lock inversion is
still possible with hardlinks as follows:

thread 1: mv dir1/10 dir2/10
thread 2: mv dir2/11 dir2/2
where dir1/10 is hardlink to dir4/2 and dir2/10 is hardlink to dir2/11

To solve this we enforce child ordering by fid in case of local rename

This should not create problems aynwhere else but rename since
the next closest candidate - link() does not delete the target
if it exists so it's not locked in that case.

Fixes: d76cc65d5d68 ("LU-12125 mds: allow parallel regular file rename")
Change-Id: Idd3525e8b1a0de411766bdcaa480c60d3b5e491b
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46352
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
lustre/mdt/mdt_reint.c