Whamcloud - gitweb
EX-3080 pcc: avoid dead lock for auto attach in PCC-RO
authorQian Yingjin <qian@ddn.com>
Wed, 12 May 2021 03:43:28 +0000 (11:43 +0800)
committerLi Xi <lixi@ddn.com>
Tue, 18 May 2021 01:41:18 +0000 (01:41 +0000)
commit640b334a96a909ce141bae1625f496eecbe427fa
treef31da97a62cf5025b168609d39ae2eff49630e22
parent1a8f8b789c1a001c7b7815a5f290c061d80a2726
EX-3080 pcc: avoid dead lock for auto attach in PCC-RO

In this patch, It releases the pcc inode lock when calling
ll_layout_refresh() in @pcc_try_auto_attach() as it may cause the
following deadlock:
1. The client is writing or truncating a file in readonly mode.
   At this time, it will send a write layout intent lock to clear
   the readonly state on the layout on MDT.
2. A read process tries to auto attach the file with pcc inode
   lock hold. During the pregress of auto attach, it will call
   ll_layout_refresh(). The client-side enqueue request for a
   layout lock returned a blocked lock, it will sleep and wait for
   the lock being granted;
3. MDT will take EX layout lock to cancel all cached layout lock
   on client to change the layout for clearing the PCC-RO state.
4. when the client handles the revocation of layout lock, it needs
   to invalidate the PCC state which needs under the protection of
   pcc inode lock.

Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: I18890d19d03726a5991c923505e8c5363382fdc2
Reviewed-on: https://review.whamcloud.com/43668
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
lustre/llite/pcc.c
lustre/tests/sanity-pcc.sh