Skip to content
Snippets Groups Projects
Commit f71bf0a8 authored by Yury Umanets's avatar Yury Umanets
Browse files

- fixed bug in ldlm_cancel_lru_local(). It should cancel locks according to...

- fixed bug in ldlm_cancel_lru_local(). It should cancel locks according to SLV only in the case of passed zero @count. If @count is not zero - cancel requested number of locks regardless SLV. Found by failure of sanityN test_20;
- raise error and return -EINVAL if ldlm_cancel_lru() did not cancel requested number of locks in case of sync cancel if lru resize is supported.
parent ec0efc8e
No related branches found
No related tags found
No related merge requests found
......@@ -1047,22 +1047,25 @@ int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels,
if (count != 0 && added > count)
break;
/* Calculate lv for every lock. */
spin_lock(&pl->pl_lock);
slv = ldlm_pool_get_slv(pl);
lvf = atomic_read(&pl->pl_lock_volume_factor);
spin_unlock(&pl->pl_lock);
la = cfs_duration_sec(cfs_time_sub(cur,
lock->l_last_used));
if (la == 0)
la = 1;
/* Cancel locks by lru only in the case of count == 0. */
if (count == 0) {
/* Calculate lv for every lock. */
spin_lock(&pl->pl_lock);
slv = ldlm_pool_get_slv(pl);
lvf = atomic_read(&pl->pl_lock_volume_factor);
spin_unlock(&pl->pl_lock);
la = cfs_duration_sec(cfs_time_sub(cur,
lock->l_last_used));
if (la == 0)
la = 1;
/* Stop when slv is not yet come from server or lv is
* smaller than it is. */
lv = lvf * la * unused;
if (slv == 1 || lv < slv)
break;
/* Stop when slv is not yet come from server or
* lv is smaller than it is. */
lv = lvf * la * unused;
if (slv == 1 || lv < slv)
break;
}
} else {
if ((added >= count) &&
(!(flags & LDLM_CANCEL_AGED) ||
......
......@@ -140,8 +140,16 @@ static int lprocfs_wr_lru_size(struct file *file, const char *buffer,
"dropping all unused locks from namespace %s\n",
ns->ns_name);
if (ns_connect_lru_resize(ns)) {
int canceled, unused = ns->ns_nr_unused;
/* Try to cancel all @ns_nr_unused locks. */
ldlm_cancel_lru(ns, ns->ns_nr_unused, LDLM_SYNC);
canceled = ldlm_cancel_lru(ns, unused, LDLM_SYNC);
if (canceled < unused) {
CERROR("not all requested locks are canceled, "
"requested: %d, canceled: %d\n", unused,
canceled);
return -EINVAL;
}
} else {
tmp = ns->ns_max_unused;
ns->ns_max_unused = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment