const struct lu_buf *buf,
loff_t pos, struct thandle *th)
{
- return osp_trans_update_request_create(th);
+ struct osp_device *osp = dt2osp_dev(th->th_dev);
+ int rc;
+
+ rc = osp_trans_update_request_create(th);
+ if (rc != 0)
+ return rc;
+
+ if (osp->opd_update == NULL)
+ return 0;
+
+ if (dt2osp_obj(dt)->opo_stale)
+ return -ESTALE;
+
+ return 0;
}
/**
update = thandle_to_osp_update_request(th);
LASSERT(update != NULL);
+ CDEBUG(D_INFO, "write "DFID" offset = "LPU64" length = %zu\n",
+ PFID(lu_object_fid(&dt->do_lu)), *pos, buf->lb_len);
+
rc = osp_update_rpc_pack(env, write, update, OUT_WRITE,
lu_object_fid(&dt->do_lu), buf, *pos);
if (rc < 0)
RETURN(rc);
- CDEBUG(D_INFO, "write "DFID" offset = "LPU64" length = %zu\n",
- PFID(lu_object_fid(&dt->do_lu)), *pos, buf->lb_len);
+ rc = osp_check_and_set_rpc_version(oth, obj);
+ if (rc < 0)
+ RETURN(rc);
/* XXX: how about the write error happened later? */
*pos += buf->lb_len;
obj->opo_ooa->ooa_attr.la_size < *pos)
obj->opo_ooa->ooa_attr.la_size = *pos;
- rc = osp_check_and_set_rpc_version(oth);
- if (rc < 0)
- RETURN(rc);
-
RETURN(buf->lb_len);
}
GOTO(out_update, rc);
}
+ CDEBUG(D_INFO, "%s "DFID" read offset %llu size %zu\n",
+ dt_dev->dd_lu_dev.ld_obd->obd_name,
+ PFID(lu_object_fid(&dt->do_lu)), *pos, rbuf->lb_len);
rc = osp_prep_update_req(env, osp->opd_obd->u.cli.cl_import, update,
&req);
if (rc != 0)