Whamcloud - gitweb
LU-9679 osc: fix to return right weight in osc_lock_weight() 35/37735/2
authorWang Shilong <wshilong@ddn.com>
Thu, 27 Feb 2020 01:36:05 +0000 (09:36 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 5 Mar 2020 22:35:34 +0000 (22:35 +0000)
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 <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/37735
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osc/osc_lock.c

index 6ad53ce..d50fddb 100644 (file)
@@ -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);