From 1676073d49b314ade314170ad9758cc878c14703 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Thu, 27 Feb 2020 09:36:05 +0800 Subject: [PATCH] LU-9679 osc: fix to return right weight in osc_lock_weight() cl_io_init() might return a negative value, it could be indicated lock should be not eliminated, osc_lock_weight() expect a positive value, fix to return 1 in this case. This is not a problem for now, as osc_io_init() only return 0, To avoid any potential issues in the future, better fix it. Test-Parameters: trivial Change-Id: I657e5dcc4bb7691bf3b4ca06df7cb87945008a93 Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/37735 Tested-by: jenkins Reviewed-by: Neil Brown Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/osc/osc_lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index 6ad53ce..d50fddb 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -677,7 +677,7 @@ static unsigned long osc_lock_weight(const struct lu_env *env, io->ci_ignore_layout = 1; result = cl_io_init(env, io, CIT_MISC, io->ci_obj); if (result != 0) - RETURN(result); + RETURN(1); page_index = cl_index(obj, start); -- 1.8.3.1