From: Andriy Skulysh Date: Thu, 12 Sep 2013 07:10:59 +0000 (+0300) Subject: LU-3936 ldlm: ldlm_cancel_stale_locks()) ASSERTION( count > 0 ) failed X-Git-Tag: 2.5.51~61 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=7a985f7e613e176f45d6b89aa5e7861203394bc8;hp=0bdd2c864c26e6f48c57505aa6e4143bf1497833 LU-3936 ldlm: ldlm_cancel_stale_locks()) ASSERTION( count > 0 ) failed number of granted locks can be really huge. Use 64bit math to calculate amount of locks to cancel Change-Id: Iac0b52dd578baf9955b50597d0832ac8715895f1 Xyratex-bug-id: MRP-1296 Signed-off-by: Andriy Skulysh Reviewed-by: Alexey Lyashkov Reviewed-by: Alexander Boyko Reviewed-by: Vitaly Fertman Reviewed-on: http://review.whamcloud.com/7626 Tested-by: Hudson Reviewed-by: Alexander Boyko Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c index 3259ff8..734b330 100644 --- a/lustre/ldlm/ldlm_pool.c +++ b/lustre/ldlm/ldlm_pool.c @@ -1059,7 +1059,7 @@ __u32 ldlm_pool_get_lvf(struct ldlm_pool *pl) EXPORT_SYMBOL(ldlm_pool_get_lvf); #ifdef __KERNEL__ -static int ldlm_pool_granted(struct ldlm_pool *pl) +static unsigned int ldlm_pool_granted(struct ldlm_pool *pl) { return cfs_atomic_read(&pl->pl_granted); } @@ -1077,7 +1077,8 @@ static struct completion ldlm_pools_comp; static int ldlm_pools_shrink(ldlm_side_t client, int nr, unsigned int gfp_mask) { - int total = 0, cached = 0, nr_ns; + unsigned int total = 0, cached = 0; + int nr_ns; struct ldlm_namespace *ns; struct ldlm_namespace *ns_old = NULL; /* loop detection */ void *cookie; @@ -1137,7 +1138,8 @@ static int ldlm_pools_shrink(ldlm_side_t client, int nr, for (nr_ns = ldlm_namespace_nr_read(client) - nr_ns; nr_ns > 0; nr_ns--) { - int cancel, nr_locks; + __u64 cancel; + unsigned int nr_locks; /* * Do not call shrink under ldlm_namespace_lock(client) @@ -1159,8 +1161,9 @@ static int ldlm_pools_shrink(ldlm_side_t client, int nr, mutex_unlock(ldlm_namespace_lock(client)); nr_locks = ldlm_pool_granted(&ns->ns_pool); - cancel = 1 + nr_locks * nr / total; - ldlm_pool_shrink(&ns->ns_pool, cancel, gfp_mask); + cancel = (__u64)nr_locks * nr; + do_div(cancel, total); + ldlm_pool_shrink(&ns->ns_pool, 1 + cancel, gfp_mask); cached += ldlm_pool_granted(&ns->ns_pool); ldlm_namespace_put(ns); }