Whamcloud - gitweb
LU-16139 statahead: avoid to block ptlrpcd interpret context 51/48451/5
authorQian Yingjin <qian@ddn.com>
Wed, 7 Sep 2022 08:59:19 +0000 (04:59 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Oct 2022 17:24:37 +0000 (17:24 +0000)
commit2e0897439014338553a51fae338fb2c1b655f067
tree643966ae48d8526a7baa9f6235600ba6f7aa5cd6
parenta966b624ac76e34e8ed28c6980c3f58cb441eeb0
LU-16139 statahead: avoid to block ptlrpcd interpret context

If a stat-ahead entry is a striped directory or a regular file
with layout change, it will generate a new RPC and block ptlrpcd
interpret context for a long time.
However, it is dangerous of blocking in ptlrpcd thread as it may
result in deadlock.

The following is the stack trace for the timeout of replay-dual
test_26:
task:ptlrpcd_00_01   state:I stack:    0 pid: 8026 ppid:     2
osc_extent_wait+0x44d/0x560 [osc]
osc_cache_wait_range+0x2b8/0x930 [osc]
osc_io_fsync_end+0x67/0x80 [osc]
cl_io_end+0x58/0x130 [obdclass]
lov_io_end_wrapper+0xcf/0xe0 [lov]
lov_io_fsync_end+0x6f/0x1c0 [lov]
cl_io_end+0x58/0x130 [obdclass]
cl_io_loop+0xa7/0x200 [obdclass]
cl_sync_file_range+0x2c9/0x340 [lustre]
vvp_prune+0x5d/0x1e0 [lustre]
cl_object_prune+0x58/0x130 [obdclass]
lov_layout_change.isra.47+0x1ba/0x640 [lov]
lov_conf_set+0x38d/0x4e0 [lov]
cl_conf_set+0x60/0x140 [obdclass]
cl_file_inode_init+0xc8/0x380 [lustre]
ll_update_inode+0x432/0x6e0 [lustre]
ll_iget+0x227/0x320 [lustre]
ll_prep_inode+0x344/0xb60 [lustre]
ll_statahead_interpret_common.isra.26+0x69/0x830 [lustre]
ll_statahead_interpret+0x2c8/0x5b0 [lustre]
mdc_intent_getattr_async_interpret+0x14a/0x3e0 [mdc]
ptlrpc_check_set+0x5b8/0x1fe0 [ptlrpc]
ptlrpcd+0x6c6/0xa50 [ptlrpc]

In this patch, we use work queue to handle the extra RPC and long
wait in a separate thread for a striped directory and a regular
file with layout change:
(@ll_prep_inode->@lmv_revalidate_slaves);
(@ll_prep_inode->@lov_layout_change->osc_cache_wait_range)

Test-Parameters: testlist=replay-dual env=ONLY=26,ONLY_REPEAT=10 mdscount=2 mdtcount=4
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: I404a320620c4ec4caa608e675ecf324fcd26f1e0
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48451
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_intent.h
lustre/include/obd.h
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/statahead.c
lustre/mdc/mdc_locks.c