From: Wang Shilong Date: Thu, 27 Feb 2020 01:36:05 +0000 (+0800) Subject: LU-9679 osc: fix to return right weight in osc_lock_weight() X-Git-Tag: 2.13.53~133 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=1676073d49b314ade314170ad9758cc878c14703;p=fs%2Flustre-release.git 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 --- 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);