From: Gu Zheng Date: Mon, 24 Jun 2019 05:51:20 +0000 (+0800) Subject: LU-11518 osc: cancel osc_lock list traversal once found the lock is being used X-Git-Tag: 2.12.56~27 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=eb9aa909343b95769cbf90eec36ded8821d4aa12 LU-11518 osc: cancel osc_lock list traversal once found the lock is being used Currently, in osc_ldlm_weigh_ast, it walks osc_lock list (oo_ol_list) to check whether target dlm is being used, normally, if found, it needs to skip the rest ones and cancel the traversal, but it doesn't, let's fix it here. Change-Id: I2e64d2938cdacb6c5baca73647d74c9fb8f54f8c Fixes: 3f3a24dc5d7d ("LU-3259 clio: cl_lock simplification") Signed-off-by: Gu Zheng Reviewed-on: https://review.whamcloud.com/35396 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger Reviewed-by: Li Xi Reviewed-by: Oleg Drokin --- diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index 19beda2..abef4f6 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -696,9 +696,10 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock) spin_lock(&obj->oo_ol_spin); list_for_each_entry(oscl, &obj->oo_ol_list, ols_nextlock_oscobj) { - if (oscl->ols_dlmlock != NULL && oscl->ols_dlmlock != dlmlock) - continue; - found = true; + if (oscl->ols_dlmlock == dlmlock) { + found = true; + break; + } } spin_unlock(&obj->oo_ol_spin); if (found) {