#include <sys/queue.h>
#include <fcntl.h>
+#include <sysio.h>
#ifdef HAVE_XTIO_H
#include <xtio.h>
#endif
-#include <sysio.h>
#include <fs.h>
#include <mount.h>
#include <inode.h>
{
LASSERT(i1 != NULL || i2 != NULL);
LASSERT(op_data);
- memset(op_data, 0, sizeof(*op_data));
if (i1) {
ll_i2gids(op_data->op_suppgids, i1, i2);
valid &= src->o_valid;
if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
- CDEBUG(D_INODE,"valid "LPX64", cur time %lu/%lu, new %lu/%lu\n",
+ CDEBUG(D_INODE,"valid "LPX64", cur time "CFS_TIME_T"/"CFS_TIME_T
+ ", new %lu/%lu\n",
src->o_valid, LTIME_S(st->st_mtime),
LTIME_S(st->st_ctime),
(long)src->o_mtime, (long)src->o_ctime);
struct mdt_body *body;
ENTRY;
- body = lustre_msg_buf(req->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body));
- LASSERT(body != NULL); /* reply already checked out */
- LASSERT_REPSWABBED(req, DLM_REPLY_REC_OFF); /* and swabbed down */
+ body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
+ LASSERT(body != NULL);
/* already opened? */
if (lli->lli_open_count++)
RETURN(rc);
}
-int llu_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
+int llu_objects_destroy(struct ptlrpc_request *req, struct inode *dir)
{
struct mdt_body *body;
struct lov_mds_md *eadata;
int rc;
ENTRY;
- /* req is swabbed so this is safe */
- body = lustre_msg_buf(request->rq_repmsg, REPLY_REC_OFF, sizeof(*body));
+ body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if (!(body->valid & OBD_MD_FLEASIZE))
RETURN(0);
* to this file. Use this EA to unlink the objects on the OST.
* It's opaque so we don't swab here; we leave it to obd_unpackmd() to
* check it is complete and sensible. */
- eadata = lustre_swab_repbuf(request, REPLY_REC_OFF+1, body->eadatasize,
- NULL);
+ eadata = req_capsule_server_sized_get(&req->rq_pill, &RMF_MDT_MD,
+ body->eadatasize);
+
LASSERT(eadata != NULL);
- if (eadata == NULL) {
- CERROR("Can't unpack MDS EA data\n");
- GOTO(out, rc = -EPROTO);
- }
rc = obd_unpackmd(llu_i2obdexp(dir), &lsm, eadata,body->eadatasize);
if (rc < 0) {
if (body->valid & OBD_MD_FLCOOKIE) {
oa->o_valid |= OBD_MD_FLCOOKIE;
oti.oti_logcookies =
- lustre_msg_buf(request->rq_repmsg, REPLY_REC_OFF + 2,
- sizeof(struct llog_cookie) *
- lsm->lsm_stripe_count);
+ req_capsule_server_sized_get(&req->rq_pill,
+ &RMF_LOGCOOKIES,
+ sizeof(struct llog_cookie) *
+ lsm->lsm_stripe_count);
if (oti.oti_logcookies == NULL) {
oa->o_valid &= ~OBD_MD_FLCOOKIE;
body->valid &= ~OBD_MD_FLCOOKIE;
return rc;
}
-int llu_sizeonmds_update(struct inode *inode, struct lustre_handle *fh,
- __u64 ioepoch)
+int llu_sizeonmds_update(struct inode *inode, struct md_open_data *mod,
+ struct lustre_handle *fh, __u64 ioepoch)
{
struct llu_inode_info *lli = llu_i2info(inode);
struct llu_sb_info *sbi = llu_i2sbi(inode);
- struct md_op_data op_data;
+ struct md_op_data op_data = {{ 0 }};
struct obdo oa;
int rc;
ENTRY;
LASSERT(sbi->ll_lco.lco_flags & OBD_CONNECT_SOM);
rc = llu_inode_getattr(inode, &oa);
- if (rc) {
+ if (rc == -ENOENT) {
+ oa.o_valid = 0;
+ CDEBUG(D_INODE, "objid "LPX64" is already destroyed\n",
+ lli->lli_smd->lsm_object_id);
+ } else if (rc) {
CERROR("inode_getattr failed (%d): unable to send a "
"Size-on-MDS attribute update for inode %llu/%lu\n",
rc, (long long)llu_i2stat(inode)->st_ino,
op_data.op_ioepoch = ioepoch;
op_data.op_flags |= MF_SOM_CHANGE;
- rc = llu_md_setattr(inode, &op_data);
+ rc = llu_md_setattr(inode, &op_data, &mod);
RETURN(rc);
}
struct obd_client_handle *och = &fd->fd_mds_och;
struct intnl_stat *st = llu_i2stat(inode);
struct md_op_data op_data = { { 0 } };
- int rc;
+ int seq_end = 0, rc;
ENTRY;
/* clear group lock, if present */
op_data.op_ioepoch = lli->lli_ioepoch;
memcpy(&op_data.op_handle, &och->och_fh, sizeof(op_data.op_handle));
- rc = md_close(md_exp, &op_data, och, &req);
+ rc = md_close(md_exp, &op_data, och->och_mod, &req);
+ if (rc != -EAGAIN)
+ seq_end = 1;
+
if (rc == -EAGAIN) {
/* We are the last writer, so the MDS has instructed us to get
* the file size and any write cookies, then close again. */
LASSERT(fd->fd_flags & FMODE_WRITE);
- rc = llu_sizeonmds_update(inode, &och->och_fh,
+ rc = llu_sizeonmds_update(inode, och->och_mod, &och->och_fh,
op_data.op_ioepoch);
if (rc) {
CERROR("inode %llu mdc Size-on-MDS update failed: "
(long long)st->st_ino, rc);
}
+ if (seq_end)
+ ptlrpc_close_replay_seq(req);
md_clear_open_replay_data(md_exp, och);
ptlrpc_req_finished(req);
och->och_fh.cookie = DEAD_HANDLE_MAGIC;
}
/* if open count == 0 && stale_flag is set, should we
* remove the inode immediately? */
- liblustre_wait_event(0);
+ liblustre_wait_idle();
return 0;
}