Whamcloud - gitweb
LU-16633 obdclass: fix rpc slot leakage 39/51539/3
authorAlex Zhuravlev <bzzz@whamcloud.com>
Fri, 10 Mar 2023 17:47:05 +0000 (20:47 +0300)
committerOleg Drokin <green@whamcloud.com>
Sun, 16 Jun 2024 03:34:52 +0000 (03:34 +0000)
commit1757e9b119720016f6fa2c2ac35c144e0c92d75f
tree5a43669ff706e849da4cd51b354ec65c2aeee501
parenta3200ab63ad83241bf5383c9be750c42bf104239
LU-16633 obdclass: fix rpc slot leakage

obd_get_mod_rpc_slot() can race with obd_put_mod_rpc_slot():
finishing wait_woken() resets WQ_FLAG_WOKEN (which is set
when the corresponding thread gets a slot incrementing
cl_mod_rpcs_in_flight. then another thread execting
__wake_up_locked_key() may find that wq_entry again and call
claim_mod_rpc_function() one more time again incrementing
cl_mod_rpc_in_flight. thus it's incremented twice for a
single obd_get_mod_rpc_slot().

    #1: obd_get_mod_rpc_slot() #2: obd_put_mod_rpc_slot()
    flags &= ~WQ_FLAG_WOKEN
    list_add()
    wait_woken()
schedule claim_mod_rpc_function()
cl_mod_rpcs_in_flight++
wake_up()

flags &= ~WQ_FLAG_WOKEN

#3: obd_put_mod_rpc_slot()
claim_mod_rpc_function()
cl_mod_rpcs_in_flight++
wake_up()
    list_del()

the patch introduces a replacement for WQ_FLAG_WOKEN which is never
reset once set.

Lustre-change: https://review.whamcloud.com/50261
Lustre-commit: 91a3726f313df33e099320d171039f8371fec27f

Fixes: 5243630b09 ("LU-15947 obdclass: improve precision of wakeups for mod_rpcs")
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I29371c8c85414413c5a8e41dec3632f64ad127bb
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51539
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/mdc/mdc_request.c
lustre/obdclass/genops.c