Fix the comment to properly indicate it returns ERR_PTR on
error and fix osc_req_attr_set() and mdc_get_lock_handle()
to actually check the return value before passing it on and
causing an unintended crash.
Change-Id: Ib85a62140a39744e85989c9a9c8aa2ed771d70d1
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44738
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
* Return a reference to resource with given name, creating it if necessary.
* Args: namespace with ns_lock unlocked
* Locks: takes and releases NS hash-lock and res->lr_lock
* Return a reference to resource with given name, creating it if necessary.
* Args: namespace with ns_lock unlocked
* Locks: takes and releases NS hash-lock and res->lr_lock
- * Returns: referenced, unlocked ldlm_resource or NULL
+ * Returns: referenced, unlocked ldlm_resource or ERR_PTR
*/
struct ldlm_resource *
ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
*/
struct ldlm_resource *
ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
fid_build_reg_res_name(lu_object_fid(osc2lu(osc)), resname);
res = ldlm_resource_get(osc_export(osc)->exp_obd->obd_namespace,
NULL, resname, LDLM_IBITS, 0);
fid_build_reg_res_name(lu_object_fid(osc2lu(osc)), resname);
res = ldlm_resource_get(osc_export(osc)->exp_obd->obd_namespace,
NULL, resname, LDLM_IBITS, 0);
- ldlm_resource_dump(D_ERROR, res);
+ if (IS_ERR(res))
+ CERROR("No lock resource for "DFID"\n",
+ PFID(lu_object_fid(osc2lu(osc))));
+ else
+ ldlm_resource_dump(D_ERROR, res);
libcfs_debug_dumpstack(NULL);
return -ENOENT;
} else {
libcfs_debug_dumpstack(NULL);
return -ENOENT;
} else {
res = ldlm_resource_get(
osc_export(cl2osc(obj))->exp_obd->obd_namespace,
NULL, resname, LDLM_EXTENT, 0);
res = ldlm_resource_get(
osc_export(cl2osc(obj))->exp_obd->obd_namespace,
NULL, resname, LDLM_EXTENT, 0);
- ldlm_resource_dump(D_ERROR, res);
+ if (IS_ERR(res))
+ CERROR("No lock resource\n");
+ else
+ ldlm_resource_dump(D_ERROR, res);
libcfs_debug_dumpstack(NULL);
LBUG();
libcfs_debug_dumpstack(NULL);
LBUG();