From 63afdff76c490944bafdb71457df0c92987e175d Mon Sep 17 00:00:00 2001 From: tappro Date: Sun, 27 Aug 2006 22:34:10 +0000 Subject: [PATCH] - add fid to the obd_client_handle and use it to select right mds in lmv_set/clear_open_replay_data() - add assert in ll_update_inode() for FID overwritting - small fixes --- lustre/include/lustre_lib.h | 1 + lustre/llite/file.c | 3 ++- lustre/llite/llite_lib.c | 13 +++++++++++-- lustre/lmv/lmv_intent.c | 8 ++++---- lustre/lmv/lmv_obd.c | 16 ++++++++++++---- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index 77e1f0e..b9a6903 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -87,6 +87,7 @@ struct client_obd *client_conn2cli(struct lustre_handle *conn); struct mdc_open_data; struct obd_client_handle { struct lustre_handle och_fh; + struct lu_fid *och_fid; struct llog_cookie och_cookie; struct mdc_open_data *och_mod; __u32 och_magic; diff --git a/lustre/llite/file.c b/lustre/llite/file.c index ac1b588..171210c 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -340,9 +340,10 @@ static void ll_och_fill(struct obd_export *md_exp, struct ll_inode_info *lli, memcpy(&och->och_fh, &body->handle, sizeof(body->handle)); och->och_magic = OBD_CLIENT_HANDLE_MAGIC; + och->och_fid = &lli->lli_fid; lli->lli_io_epoch = body->io_epoch; - md_set_open_replay_data(md_exp, och, it->d.lustre.it_data); + md_set_open_replay_data(md_exp, och, req); } int ll_local_open(struct file *file, struct lookup_intent *it, diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index c1768f3..3d24735 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1648,8 +1648,17 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) if (body->valid & OBD_MD_FLSIZE) set_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &lli->lli_flags); - if (body->valid & OBD_MD_FLID) - lli->lli_fid = body->fid1; + if (body->valid & OBD_MD_FLID) { + /* FID shouldn't be changed! */ + if (fid_is_sane(&lli->lli_fid)) { + LASSERTF(lu_fid_eq(&lli->lli_fid, &body->fid1), + "Trying to change FID "DFID + " to the "DFID", inode %lu/%u(%p)\n", + PFID(&lli->lli_fid), PFID(&body->fid1), + inode->i_ino, inode->i_generation, inode); + } else + lli->lli_fid = body->fid1; + } LASSERT(fid_seq(&lli->lli_fid) != 0); } diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index c314074..9426431 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -65,7 +65,6 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm, struct lustre_handle plock; struct md_op_data *op_data; struct obd_export *tgt_exp; - struct lu_fid nid; int pmode, rc = 0; ENTRY; @@ -99,16 +98,15 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm, LASSERT(fid_is_sane(&body->fid1)); - nid = body->fid1; it->d.lustre.it_disposition &= ~DISP_ENQ_COMPLETE; OBD_ALLOC_PTR(op_data); if (op_data == NULL) GOTO(out, rc = -ENOMEM); - op_data->fid1 = nid; + op_data->fid1 = body->fid1; - tgt_exp = lmv_get_export(lmv, &nid); + tgt_exp = lmv_get_export(lmv, &body->fid1); if (IS_ERR(tgt_exp)) RETURN(PTR_ERR(tgt_exp)); @@ -392,6 +390,8 @@ int lmv_intent_getattr(struct obd_export *exp, const struct lu_fid *pid, if (it->d.lustre.it_disposition & DISP_LOOKUP_NEG) GOTO(out_free_op_data, rc = 0); + LASSERT(*reqp); + LASSERT((*reqp)->rq_repmsg); body = lustre_msg_buf((*reqp)->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); LASSERT(body != NULL); diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 669f335..6531e7d 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -2284,7 +2284,8 @@ int lmv_lock_match(struct obd_export *exp, int flags, } int lmv_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req, - int offset, struct obd_export *dt_exp, struct lustre_md *md) + int offset, struct obd_export *dt_exp, + struct lustre_md *md) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; @@ -2310,10 +2311,13 @@ int lmv_set_open_replay_data(struct obd_export *exp, { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; + struct obd_export *tgt_exp; ENTRY; - RETURN(md_set_open_replay_data(lmv->tgts[0].ltd_exp, - och, open_req)); + + tgt_exp = lmv_get_export(lmv, och->och_fid); + + RETURN(md_set_open_replay_data(tgt_exp, och, open_req)); } int lmv_clear_open_replay_data(struct obd_export *exp, @@ -2321,9 +2325,13 @@ int lmv_clear_open_replay_data(struct obd_export *exp, { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; + struct obd_export *tgt_exp; ENTRY; - RETURN(md_clear_open_replay_data(lmv->tgts[0].ltd_exp, och)); + + tgt_exp = lmv_get_export(lmv, och->och_fid); + + RETURN(md_clear_open_replay_data(tgt_exp, och)); } struct obd_ops lmv_obd_ops = { -- 1.8.3.1