From: Jinshan Xiong Date: Tue, 28 Oct 2014 02:20:07 +0000 (-0400) Subject: LU-5727 ldlm: revert the changes for lock canceling policy X-Git-Tag: 2.5.3.90~35 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F65%2F12565%2F5;p=fs%2Flustre-release.git LU-5727 ldlm: revert the changes for lock canceling policy The changes for LRU lock policy was introduced by commit 0a6c6fcd4, where I was trying to revise the policy to pick locks for canceling. However, this caused two problems as mentioned in LU-5727. The first problem is that the lock can only be picked for canceling only if the number of LRU locks is over preset LRU number AND it's aged; the second problem is that mdc_cancel_weight() tends to not cancel OPEN locks, therefore open locks can be kept forever and finally exhausts memory on the MDT side. This patch will revert the changes related to LRU policy revision. This is backported from master: Lustre-change: http://review.whamcloud.com/12733 LU-5727 ldlm: revert changes to ldlm_cancel_aged_policy() The changes to ldlm_cancel_aged_policy() intrdouced from LU-4300 (bfae5a) was incorrect. This patch revert this part of changes. This is backported from master: Lustre-change: http://review.whamcloud.com/12448 Lustre-commit: e8812867e8c6c9eb62174b370cb818985e3d2180 Signed-off-by: Niu Yawei Signed-off-by: Jinshan Xiong Change-Id: Ic04f894c8bf54dbbdfb0e3bada5f6e4a367711a5 Reviewed-on: http://review.whamcloud.com/12565 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 560ff77..bca9db9 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -1504,9 +1504,6 @@ static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, if (slv == 0 || lv < slv) return LDLM_POLICY_KEEP_LOCK; - if (ns->ns_cancel != NULL && ns->ns_cancel(lock) == 0) - return LDLM_POLICY_KEEP_LOCK; - return LDLM_POLICY_CANCEL_LOCK; } @@ -1544,15 +1541,10 @@ static ldlm_policy_res_t ldlm_cancel_aged_policy(struct ldlm_namespace *ns, int unused, int added, int count) { - if (added >= count) - return LDLM_POLICY_KEEP_LOCK; - - if (cfs_time_before(cfs_time_current(), + if ((added >= count) && + cfs_time_before(cfs_time_current(), cfs_time_add(lock->l_last_used, ns->ns_max_age))) - return LDLM_POLICY_KEEP_LOCK; - - if (ns->ns_cancel != NULL && ns->ns_cancel(lock) == 0) - return LDLM_POLICY_KEEP_LOCK; + return LDLM_POLICY_KEEP_LOCK; return LDLM_POLICY_CANCEL_LOCK; }