ENTRY;
wobdo = object_update_param_get(update, 0, &size);
- if (wobdo == NULL || IS_ERR(wobdo) || size != sizeof(*wobdo)) {
- CERROR("%s: obdo is NULL, invalid RPC: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(wobdo) || size != sizeof(*wobdo)) {
+ CERROR("%s: obdo is NULL, invalid RPC: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(wobdo));
+ RETURN(err_serious(PTR_ERR(wobdo)));
}
if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
dof->dof_type = dt_mode_to_dft(attr->la_mode);
if (update->ou_params_count > 1) {
fid = object_update_param_get(update, 1, &size);
- if (fid == NULL || IS_ERR(fid) || size != sizeof(*fid)) {
- CERROR("%s: invalid fid: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(fid) || size != sizeof(*fid)) {
+ CERROR("%s: invalid fid: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(fid));
+ RETURN(err_serious(PTR_ERR(fid)));
}
if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
lustre_swab_lu_fid(fid);
ENTRY;
wobdo = object_update_param_get(update, 0, &size);
- if (wobdo == NULL || IS_ERR(wobdo) || size != sizeof(*wobdo)) {
- CERROR("%s: empty obdo in the update: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(wobdo) || size != sizeof(*wobdo)) {
+ CERROR("%s: empty obdo in the update: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(wobdo));
+ RETURN(err_serious(PTR_ERR(wobdo)));
}
attr->la_valid = 0;
}
name = object_update_param_get(update, 0, NULL);
- if (name == NULL || IS_ERR(name)) {
- CERROR("%s: empty name for xattr get: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(name)) {
+ CERROR("%s: empty name for xattr get: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(name));
+ RETURN(err_serious(PTR_ERR(name)));
}
update_result = object_update_result_get(reply, 0, NULL);
RETURN(-ENOENT);
name = object_update_param_get(update, 0, NULL);
- if (name == NULL || IS_ERR(name)) {
- CERROR("%s: empty name for lookup: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(name)) {
+ CERROR("%s: empty name for lookup: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(name));
+ RETURN(err_serious(PTR_ERR(name)));
}
dt_read_lock(env, obj, MOR_TGT_CHILD);
ENTRY;
name = object_update_param_get(update, 0, NULL);
- if (name == NULL || IS_ERR(name)) {
- CERROR("%s: empty name for xattr set: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(name)) {
+ CERROR("%s: empty name for xattr set: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(name));
+ RETURN(err_serious(PTR_ERR(name)));
}
+ /* If buffer == NULL (-ENODATA), then it might mean delete xattr */
buf = object_update_param_get(update, 1, &buf_len);
- if (IS_ERR(buf))
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(buf) && PTR_ERR(buf) != -ENODATA)
+ RETURN(err_serious(PTR_ERR(buf)));
lbuf->lb_buf = buf;
lbuf->lb_len = buf_len;
tmp = object_update_param_get(update, 2, &size);
- if (tmp == NULL || IS_ERR(tmp) || size != sizeof(*tmp)) {
- CERROR("%s: emptry or wrong size %zu flag: rc = %d\n",
- tgt_name(tsi->tsi_tgt), size, -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(tmp) || size != sizeof(*tmp)) {
+ CERROR("%s: emptry or wrong size %zu flag: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), size, PTR_ERR(tmp));
+ RETURN(err_serious(PTR_ERR(tmp)));
}
if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
ENTRY;
name = object_update_param_get(update, 0, NULL);
- if (name == NULL || IS_ERR(name)) {
- CERROR("%s: empty name for xattr set: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(name)) {
+ CERROR("%s: empty name for xattr set: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(name));
+ RETURN(err_serious(PTR_ERR(name)));
}
rc = out_tx_xattr_del(tsi->tsi_env, obj, name, &tti->tti_tea,
ENTRY;
name = object_update_param_get(update, 0, NULL);
- if (name == NULL || IS_ERR(name)) {
- CERROR("%s: empty name for index insert: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(name)) {
+ CERROR("%s: empty name for index insert: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(name));
+ RETURN(err_serious(PTR_ERR(name)));
}
fid = object_update_param_get(update, 1, &size);
- if (fid == NULL || IS_ERR(fid) || size != sizeof(*fid)) {
- CERROR("%s: invalid fid: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(fid) || size != sizeof(*fid)) {
+ CERROR("%s: invalid fid: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(fid));
+ RETURN(err_serious(PTR_ERR(fid)));
}
if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
}
ptype = object_update_param_get(update, 2, &size);
- if (ptype == NULL || IS_ERR(ptype) || size != sizeof(*ptype)) {
- CERROR("%s: invalid type for index insert: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(ptype) || size != sizeof(*ptype)) {
+ CERROR("%s: invalid type for index insert: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(ptype));
+ RETURN(err_serious(PTR_ERR(ptype)));
}
if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
RETURN(-ENOENT);
name = object_update_param_get(update, 0, NULL);
- if (name == NULL || IS_ERR(name)) {
- CERROR("%s: empty name for index delete: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(name)) {
+ CERROR("%s: empty name for index delete: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(name));
+ RETURN(err_serious(PTR_ERR(name)));
}
rc = out_tx_index_delete(tsi->tsi_env, obj, (const struct dt_key *)name,
ENTRY;
buf = object_update_param_get(update, 0, &buf_len);
- if (buf == NULL || IS_ERR(buf) || buf_len == 0) {
- CERROR("%s: empty buf for xattr set: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(buf) || buf_len == 0) {
+ CERROR("%s: empty buf for xattr set: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(buf));
+ RETURN(err_serious(PTR_ERR(buf)));
}
lbuf->lb_buf = buf;
lbuf->lb_len = buf_len;
tmp = object_update_param_get(update, 1, &size);
- if (tmp == NULL || IS_ERR(tmp) || size != sizeof(*tmp)) {
- CERROR("%s: empty or wrong size %zu pos: rc = %d\n",
- tgt_name(tsi->tsi_tgt), size, -EPROTO);
- RETURN(err_serious(-EPROTO));
+ if (IS_ERR(tmp) || size != sizeof(*tmp)) {
+ CERROR("%s: empty or wrong size %zu pos: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), size, PTR_ERR(tmp));
+ RETURN(err_serious(PTR_ERR(tmp)));
}
if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req))
GOTO(out, rc = -ENOENT);
tmp = object_update_param_get(update, 0, NULL);
- if (tmp == NULL || IS_ERR(tmp)) {
- CERROR("%s: empty size for read: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- GOTO(out, rc = err_serious(-EPROTO));
+ if (IS_ERR(tmp)) {
+ CERROR("%s: empty size for read: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(tmp));
+ GOTO(out, rc = err_serious(PTR_ERR(tmp)));
}
size = le64_to_cpu(*(size_t *)(tmp));
tmp = object_update_param_get(update, 1, NULL);
- if (tmp == NULL || IS_ERR(tmp)) {
- CERROR("%s: empty pos for read: rc = %d\n",
- tgt_name(tsi->tsi_tgt), -EPROTO);
- GOTO(out, rc = err_serious(-EPROTO));
+ if (IS_ERR(tmp)) {
+ CERROR("%s: empty pos for read: rc = %ld\n",
+ tgt_name(tsi->tsi_tgt), PTR_ERR(tmp));
+ GOTO(out, rc = err_serious(PTR_ERR(tmp)));
}
pos = le64_to_cpu(*(__u64 *)(tmp));