From 3b3b849e8d0183f81dac0667ec15e519d6f8d8a8 Mon Sep 17 00:00:00 2001 From: nfshp Date: Tue, 8 Apr 2003 09:34:56 +0000 Subject: [PATCH] the last merge b_devel to b_cray --- lustre/liblustre/file.c | 6 +++--- lustre/liblustre/llite_lib.h | 3 ++- lustre/liblustre/super.c | 50 ++++++++++++++++++++++++++++++++++---------- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index e99ebb8..53df7f9 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -87,7 +87,7 @@ static struct inode *llu_create_node(struct inode *dir, const char *name, ll_invalidate_inode_pages(dir); #endif request = it->it_data; - body = lustre_msg_buf(request->rq_repmsg, 1); + body = lustre_msg_buf(request->rq_repmsg, 1, sizeof(*body)); } else { struct mdc_op_data op_data; struct llu_inode_info *lli_dir = llu_i2info(dir); @@ -108,7 +108,7 @@ static struct inode *llu_create_node(struct inode *dir, const char *name, inode = (struct inode*)rc; goto out; } - body = lustre_msg_buf(request->rq_repmsg, 0); + body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*body)); } inode = llu_new_inode(dir->i_fs, body->ino, body->mode); @@ -218,7 +218,7 @@ static int llu_create_obj(struct lustre_handle *conn, struct inode *inode, &iattr, lmm, lmm_size, &req); ptlrpc_req_finished(req); - obd_free_wiremd(conn, &lmm); + obd_free_diskmd(conn, &lmm); /* If we couldn't complete mdc_open() and store the stripe MD on the * MDS, we need to destroy the objects now or they will be leaked. diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index e18dcad..44d7b8b 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -31,6 +31,7 @@ struct llu_inode_info { struct ll_fid lli_fid; struct lov_stripe_md *lli_smd; char *lli_symlink_name; + /*struct semaphore lli_open_sem;*/ unsigned long lli_flags; struct list_head lli_read_extents; @@ -92,7 +93,7 @@ void generate_random_uuid(unsigned char uuid_out[16]); /* super.c */ void llu_update_inode(struct inode *inode, struct mds_body *body, - struct lov_mds_md *lmm); + struct lov_stripe_md *lmm); void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid); void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid); struct inode* llu_new_inode(struct filesys *fs, ino_t ino, mode_t mode); diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 20c7de7..a9e4f65 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -46,12 +46,18 @@ static void llu_fsop_gone(struct filesys *fs) static struct inode_ops llu_inode_ops; void llu_update_inode(struct inode *inode, struct mds_body *body, - struct lov_mds_md *lmm) + struct lov_stripe_md *lsm) { struct llu_inode_info *lli = llu_i2info(inode); - if (lmm != NULL) - obd_unpackmd(llu_i2obdconn(inode), &lli->lli_smd, lmm); + LASSERT ((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0)); + if (lsm != NULL) { + if (lli->lli_smd == NULL) + lli->lli_smd = lsm; + else + LASSERT (!memcmp (lli->lli_smd, lsm, + sizeof (*lsm))); + } if (body->valid & OBD_MD_FLID) lli->lli_st_ino = body->ino; @@ -232,7 +238,7 @@ static int llu_iop_lookup(struct pnode *pnode, struct mds_body *body; unsigned long valid; int rc; - struct ll_read_inode2_cookie lic = {.lic_body = NULL, .lic_lmm = NULL}; + struct ll_read_inode2_cookie lic = {.lic_body = NULL, .lic_lsm = NULL}; /* the mount root inode have no name, so don't call * remote in this case. but probably we need revalidate @@ -256,22 +262,44 @@ static int llu_iop_lookup(struct pnode *pnode, rc = -ENOENT; goto out; } - body = lustre_msg_buf(request->rq_repmsg, 0); + body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*body)); *inop = llu_new_inode(pnode->p_mount->mnt_fs, body->ino, body->mode); if (!inop) goto out; - lic.lic_body = lustre_msg_buf(request->rq_repmsg, 0); + lic.lic_body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*lic.lic_body)); + LASSERT (lic.lic_body != NULL); + LASSERT_REPSWABBED (request, 0); + if (S_ISREG(lic.lic_body->mode) && lic.lic_body->valid & OBD_MD_FLEASIZE) { - LASSERT(request->rq_repmsg->bufcount > 0); - lic.lic_lmm = lustre_msg_buf(request->rq_repmsg, 1); + struct lov_mds_md *lmm; + int lmm_size; + int rc; + + lmm_size = lic.lic_body->eadatasize; + if (lmm_size == 0) { + CERROR ("OBD_MD_FLEASIZE set but eadatasize 0\n"); + RETURN (-EPROTO); + } + lmm = lustre_msg_buf(request->rq_repmsg, 0 + 1, lmm_size); + LASSERT(lmm != NULL); + LASSERT_REPSWABBED (request, 0 + 1); + + rc = obd_unpackmd (&sbi->ll_osc_conn, + &lic.lic_lsm, lmm, lmm_size); + if (rc < 0) { + CERROR ("Error %d unpacking eadata\n", rc); + RETURN (rc); + } + LASSERT (rc >= sizeof (*lic.lic_lsm)); + } else { - lic.lic_lmm = NULL; + lic.lic_lsm = NULL; } - llu_update_inode(*inop, body, lic.lic_lmm); + llu_update_inode(*inop, body, lic.lic_lsm); rc = llu_inode_getattr(*inop, llu_i2info(*inop)->lli_smd, NULL); if (rc) @@ -426,7 +454,7 @@ llu_fsswop_mount(const char *source, goto out_request; } - root_body = lustre_msg_buf(request->rq_repmsg, 0); + root_body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*root_body)); LASSERT(sbi->ll_rootino != 0); root = llu_new_inode(fs, root_body->ino, root_body->mode); -- 1.8.3.1