From 4b1736af6d5e5803edf24379a5171fdea1e02763 Mon Sep 17 00:00:00 2001 From: adilger Date: Tue, 13 Dec 2005 10:32:32 +0000 Subject: [PATCH] Branch b_release_1_4_6 Fix merge breakage of join feature when IBITS locking was added. b=9912 r=green Move JOIN_FILE definitions away from potentially-conflicting VFS flags. Minor cleanups in Join file code (line wrap, whitespace). --- lustre/include/liblustre.h | 2 +- lustre/include/linux/lustre_idl.h | 14 +++++------ lustre/include/lustre/lustre_user.h | 2 +- lustre/llite/file.c | 42 ++++++++++++++++----------------- lustre/mdc/mdc_lib.c | 4 ++-- lustre/mdc/mdc_locks.c | 33 +++++++++++++++----------- lustre/mdc/mdc_request.c | 11 +++------ lustre/mds/mds_join.c | 11 +++++---- lustre/mds/mds_open.c | 7 +++--- lustre/mds/mds_reint.c | 22 ++++++++--------- lustre/obdfilter/filter.c | 16 ++++++------- lustre/obdfilter/filter_io.c | 2 +- lustre/obdfilter/filter_log.c | 9 +++---- lustre/obdfilter/filter_lvb.c | 2 -- lustre/ost/ost_handler.c | 2 +- lustre/ptlrpc/pack_generic.c | 10 ++++---- lustre/tests/sanity.sh | 47 ++++++++++++++++++++----------------- lustre/utils/lfs.c | 6 ++--- lustre/utils/liblustreapi.c | 19 ++++++++------- lustre/utils/wirecheck.c | 16 +++++++------ lustre/utils/wiretest.c | 10 ++++---- 21 files changed, 146 insertions(+), 141 deletions(-) diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index ea0ef65..2eea151 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -137,7 +137,7 @@ static inline void *kmalloc(int size, int prot) #define GFP_HIGHUSER 1 #define GFP_ATOMIC 1 #define GFP_NOFS 1 -#define IS_ERR(a) (((a) && abs((long)(a)) < 500) ? 1 : 0) +#define IS_ERR(a) ((unsigned long)(a) < 1000) #define PTR_ERR(a) ((long)(a)) #define ERR_PTR(a) ((void*)((long)(a))) diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index 134107d..a5425fd 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -237,8 +237,8 @@ static inline void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags) #define OBD_CONNECT_IBITS 0x1000ULL /* support for inodebits locks */ #define OBD_CONNECT_JOIN 0x2000ULL /* files can be concatenated */ -#define MDS_CONNECT_SUPPORTED (OBD_CONNECT_RDONLY|OBD_CONNECT_VERSION| \ - OBD_CONNECT_ACL|OBD_CONNECT_XATTR| \ +#define MDS_CONNECT_SUPPORTED (OBD_CONNECT_RDONLY | OBD_CONNECT_VERSION | \ + OBD_CONNECT_ACL | OBD_CONNECT_XATTR | \ OBD_CONNECT_IBITS | OBD_CONNECT_JOIN) #define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \ OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \ @@ -325,7 +325,7 @@ typedef uint32_t obd_count; #define OBD_FL_DEBUG_CHECK (0x00000040) /* echo client/server debug check */ #define OBD_FL_NO_USRQUOTA (0x00000100) /* the object's owner is over quota */ #define OBD_FL_NO_GRPQUOTA (0x00000200) /* the object's group is over quota */ -#define OBD_FL_CREATE_CROW (0x00000400) /* object should be created with crow */ +#define OBD_FL_CREATE_CROW (0x00000400) /* object should be create on write */ /* * set this to delegate DLM locking during obd_punch() to the OSTs. Only OSTs @@ -351,7 +351,7 @@ struct obdo { obd_time o_ctime; obd_blocks o_blocks; /* brw: cli sent cached bytes */ obd_size o_grant; - + /* 32-bit fields start here: keep an even number of them via padding */ obd_blksize o_blksize; /* optimal IO blocksize */ obd_mode o_mode; /* brw: cli sent cache remain */ @@ -621,7 +621,7 @@ typedef enum { struct ll_fid { __u64 id; /* holds object id */ __u32 generation; /* holds object generation */ - + __u32 f_type; /* holds object type or stripe idx when passing it to * OST for saving into EA. */ }; @@ -734,9 +734,9 @@ extern void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa); #define MDS_OPEN_SYNC 00010000 #define MDS_OPEN_DIRECTORY 00200000 -#define MDS_OPEN_JOIN_FILE 0040000000 /* open for join file*/ #define MDS_OPEN_DELAY_CREATE 0100000000 /* delay initial object create */ #define MDS_OPEN_OWNEROVERRIDE 0200000000 /* NFSD rw-reopen ro file for owner */ +#define MDS_OPEN_JOIN_FILE 0400000000 /* open for join file*/ #define MDS_OPEN_HAS_EA 010000000000 /* specify object create pattern */ #define MDS_OPEN_HAS_OBJS 020000000000 /* Just set the EA the obj exist */ @@ -1022,7 +1022,7 @@ typedef enum { OBD_CFG_REC = LLOG_OP_MAGIC | 0x20000, PTL_CFG_REC = LLOG_OP_MAGIC | 0x30000, /* obsolete */ LLOG_GEN_REC = LLOG_OP_MAGIC | 0x40000, - LLOG_JOIN_REC = LLOG_OP_MAGIC | 0x50000, + LLOG_JOIN_REC = LLOG_OP_MAGIC | 0x50000, LLOG_HDR_MAGIC = LLOG_OP_MAGIC | 0x45539, LLOG_LOGID_MAGIC = LLOG_OP_MAGIC | 0x4553b, } llog_op_type; diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 5a26652..119eb73 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -65,7 +65,7 @@ #define IOC_MDC_GETFILEINFO _IOWR(IOC_MDC_TYPE, 22, struct lov_mds_data *) #define O_LOV_DELAY_CREATE 0100000000 /* hopefully this does not conflict */ -#define O_JOIN_FILE 0200000000 /* hopefully this does not conflict */ +#define O_JOIN_FILE 0400000000 /* hopefully this does not conflict */ #define LL_FILE_IGNORE_LOCK 0x00000001 #define LL_FILE_GROUP_LOCKED 0x00000002 diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 6d6f60a..7767f7f 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1228,7 +1228,7 @@ static int join_sanity_check(struct inode *head, struct inode *tail) if ((ll_i2sbi(head)->ll_flags & LL_SBI_JOIN) == 0) { CERROR("server do not support join \n"); RETURN(-EINVAL); - } + } if (!S_ISREG(tail->i_mode) || !S_ISREG(head->i_mode)) { CERROR("tail ino %lu and ino head %lu must be regular\n", head->i_ino, tail->i_ino); @@ -1246,12 +1246,12 @@ static int join_sanity_check(struct inode *head, struct inode *tail) RETURN(0); } -static int join_file(struct inode *head_inode, struct file *head_filp, +static int join_file(struct inode *head_inode, struct file *head_filp, struct file *tail_filp) -{ +{ struct inode *tail_inode, *tail_parent; struct dentry *tail_dentry = tail_filp->f_dentry; - struct lookup_intent oit = {.it_op = IT_OPEN, + struct lookup_intent oit = {.it_op = IT_OPEN, .it_flags = head_filp->f_flags|O_JOIN_FILE}; struct ptlrpc_request *req = NULL; struct ll_file_data *fd; @@ -1261,9 +1261,9 @@ static int join_file(struct inode *head_inode, struct file *head_filp, __u32 tsize = head_inode->i_size; struct file *f; int rc; - ENTRY; + ENTRY; - tail_dentry = tail_filp->f_dentry; + tail_dentry = tail_filp->f_dentry; tail_inode = tail_dentry->d_inode; tail_parent = tail_dentry->d_parent->d_inode; @@ -1278,31 +1278,31 @@ static int join_file(struct inode *head_inode, struct file *head_filp, } f = get_empty_filp(); - if (!f) { - ll_file_data_put(fd); + if (f == NULL) GOTO(out, rc = -ENOMEM); - } + f->f_dentry = head_filp->f_dentry; f->f_vfsmnt = head_filp->f_vfsmnt; ll_prepare_mdc_op_data(op_data, head_inode, tail_parent, tail_dentry->d_name.name, tail_dentry->d_name.len, 0); - rc = mdc_enqueue(ll_i2mdcexp(head_inode), LDLM_PLAIN, &oit, LCK_PW, + rc = mdc_enqueue(ll_i2mdcexp(head_inode), LDLM_IBITS, &oit, LCK_PW, op_data, &lockh, &tsize, 0, ldlm_completion_ast, ll_mdc_blocking_ast, &hsize, 0); + if (rc < 0) + GOTO(out, rc); + req = oit.d.lustre.it_data; rc = oit.d.lustre.it_status; - if (rc < 0) { - ll_file_data_put(fd); + if (rc < 0) GOTO(out, rc); - } rc = ll_local_open(f, &oit, fd); LASSERTF(rc == 0, "rc = %d\n", rc); - + fd = NULL; ll_intent_release(&oit); @@ -1317,7 +1317,7 @@ out: RETURN(rc); } -static int ll_file_join(struct inode *head, struct file *filp, +static int ll_file_join(struct inode *head, struct file *filp, char *filename_tail) { struct inode *tail = NULL, *first, *second; @@ -1329,9 +1329,9 @@ static int ll_file_join(struct inode *head, struct file *filp, int rc = 0, cleanup_phase = 0; ENTRY; - CDEBUG(D_VFSTRACE, "VFS Op:head=%lu/%u(%p) tail %s\n", + CDEBUG(D_VFSTRACE, "VFS Op:head=%lu/%u(%p) tail %s\n", head->i_ino, head->i_generation, head, filename_tail); - + tail_filp = filp_open(filename_tail, O_WRONLY, 0644); if (IS_ERR(tail_filp)) { CERROR("Can not open tail file %s", filename_tail); @@ -1386,12 +1386,12 @@ cleanup: switch (cleanup_phase) { case 3: ll_tree_unlock(&second_tree); - obd_cancel_unused(ll_i2obdexp(second), + obd_cancel_unused(ll_i2obdexp(second), ll_i2info(second)->lli_smd, 0, NULL); case 2: ll_tree_unlock(&first_tree); - obd_cancel_unused(ll_i2obdexp(first), - ll_i2info(first)->lli_smd, 0, NULL); + obd_cancel_unused(ll_i2obdexp(first), + ll_i2info(first)->lli_smd, 0, NULL); case 1: filp_close(tail_filp, 0); if (tail) @@ -1459,7 +1459,7 @@ int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd, case LL_IOC_JOIN: { char *ftail; int rc; - + ftail = getname((const char *)arg); if (IS_ERR(ftail)) RETURN(PTR_ERR(ftail)); diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 289b096..1f614df 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -122,11 +122,11 @@ static __u32 mds_pack_open_flags(__u32 flags) } /* packing of MDS records */ -void mdc_join_pack(struct ptlrpc_request *req, int offset, +void mdc_join_pack(struct ptlrpc_request *req, int offset, struct mdc_op_data *op_data, __u64 head_size) { struct mds_rec_join *rec; - + rec = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*rec)); LASSERT(rec != NULL); rec->jr_fid = op_data->fid2; diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 2ea9dbe..a3c2d54 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -280,19 +280,24 @@ int mdc_enqueue(struct obd_export *exp, if (it->it_flags & O_JOIN_FILE) { __u64 head_size = *(__u32*)cb_data; - __u32 tsize = *(__u32*)lmm; - size[req_buffers++] = sizeof(struct mds_rec_join); - req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_DLM_VERSION, - LDLM_ENQUEUE, req_buffers, size, NULL); - /*when joining file, cb_data and lmm args together - *indicate the head file size*/ - mdc_join_pack(req, req_buffers - 1, data, - head_size << 32 | tsize); + __u32 tsize = *(__u32*)lmm; + + /* join is like an unlink of the tail */ + policy.l_inodebits.bits = MDS_INODELOCK_UPDATE; + size[req_buffers++] = sizeof(struct mds_rec_join); + req = ptlrpc_prep_req(class_exp2cliimp(exp), + LUSTRE_DLM_VERSION, LDLM_ENQUEUE, + req_buffers, size, NULL); + /* when joining file, cb_data and lmm args together + * indicate the head file size*/ + mdc_join_pack(req, req_buffers - 1, data, + (head_size << 32) | tsize); cb_data = NULL; lmm = NULL; } else - req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_DLM_VERSION, - LDLM_ENQUEUE, req_buffers, size, NULL); + req = ptlrpc_prep_req(class_exp2cliimp(exp), + LUSTRE_DLM_VERSION, LDLM_ENQUEUE, + req_buffers, size, NULL); if (!req) RETURN(-ENOMEM); @@ -441,15 +446,15 @@ int mdc_enqueue(struct obd_export *exp, RETURN (-EPROTO); } if (body->valid & OBD_MD_FLMODEASIZE) { - LASSERTF(it->it_flags & O_JOIN_FILE, - "flags %#x should include join\n", it->it_flags); + LASSERTF(it->it_flags & O_JOIN_FILE, + "flags %#x should include join\n",it->it_flags); if (obddev->u.cli.cl_max_mds_easize < body->eadatasize){ obddev->u.cli.cl_max_mds_easize = body->eadatasize; CDEBUG(D_INFO, "change maxeasize to %d,\n", body->eadatasize); } - if (obddev->u.cli.cl_max_mds_cookiesize < - body->capability) { + if (obddev->u.cli.cl_max_mds_cookiesize < + body->capability) { obddev->u.cli.cl_max_mds_cookiesize =body->capability; CDEBUG(D_INFO, "change maxcookiesize to %d,\n", body->capability); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index e3e386c..6703cfb 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -866,16 +866,13 @@ out: return rc; } -#define INIT_RECOV_BACKUP "init_recov_bk" int mdc_set_info(struct obd_export *exp, obd_count keylen, void *key, obd_count vallen, void *val) { struct obd_import *imp = class_exp2cliimp(exp); int rc = -EINVAL; - /* Try to "recover" the initial connection; i.e. retry */ - if (keylen == strlen("initial_recov") && - memcmp(key, "initial_recov", strlen("initial_recov")) == 0) { + if (KEY_IS("initial_recov")) { if (vallen != sizeof(int)) RETURN(-EINVAL); imp->imp_initial_recov = *(int *)val; @@ -884,8 +881,7 @@ int mdc_set_info(struct obd_export *exp, obd_count keylen, RETURN(0); } /* Turn off initial_recov after we try all backup servers once */ - if (keylen == strlen(INIT_RECOV_BACKUP) && - memcmp(key, INIT_RECOV_BACKUP, strlen(INIT_RECOV_BACKUP)) == 0) { + if (KEY_IS("init_recov_bk")) { if (vallen != sizeof(int)) RETURN(-EINVAL); imp->imp_initial_recov_bk = *(int *)val; @@ -895,8 +891,7 @@ int mdc_set_info(struct obd_export *exp, obd_count keylen, exp->exp_obd->obd_name, imp->imp_initial_recov_bk); RETURN(0); } - if (keylen == strlen("read-only") && - memcmp(key, "read-only", strlen("read-only")) == 0) { + if (KEY_IS("read-only")) { struct ptlrpc_request *req; int size[2] = {keylen, vallen}; char *bufs[2] = {key, val}; diff --git a/lustre/mds/mds_join.c b/lustre/mds/mds_join.c index 04c35cf..a78c7c4 100644 --- a/lustre/mds/mds_join.c +++ b/lustre/mds/mds_join.c @@ -277,7 +277,7 @@ static int mds_join_unlink_tail_inode(struct mds_update_record *rec, } if (!S_ISREG(tail_inode->i_mode)) { - CERROR("tail file is not a regular file (dir %lu, name %s) !\n", + CERROR("tail file is not a regular file (dir %lu, name %s)!\n", de_tailparent? de_tailparent->d_inode->i_ino : 0, rec->ur_name); GOTO(cleanup, rc = -EINVAL); @@ -397,7 +397,8 @@ int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req, cleanup_phase = 3; llog_array = &llh_head->lgh_id; CDEBUG(D_INFO,"create arrary for %lu with id "LPU64":"LPU64"\n", - head_inode->i_ino, llog_array->lgl_oid, llog_array->lgl_ogr); + head_inode->i_ino, llog_array->lgl_oid, + llog_array->lgl_ogr); rc = llog_init_handle(llh_head, LLOG_F_IS_PLAIN, NULL); if (rc) GOTO(cleanup, rc); @@ -405,7 +406,7 @@ int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req, if (head_lmmj == NULL) GOTO(cleanup, rc = -ENOMEM); mds_init_stripe_join(head_lmmj, head_lmm, llog_array); - mds_insert_join_lmm(llh_head, head_lmm, 0, join_rec->jr_headsize, + mds_insert_join_lmm(llh_head, head_lmm, 0,join_rec->jr_headsize, head_lmmj); } else { /*head lmm is join file */ head_lmmj = (struct lov_mds_md_join *)head_lmm; @@ -422,7 +423,7 @@ int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req, GOTO(cleanup, rc); rc = mds_adjust_last_extent(llh_head, join_rec->jr_headsize); if (rc) { - CERROR("can not adjust last extent of the obj rc=%d\n", rc); + CERROR("can't adjust last extent of obj rc=%d\n", rc); GOTO(cleanup, rc); } } @@ -434,7 +435,7 @@ int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req, struct mdsea_cb_data cbdata; tail_lmmj = (struct lov_mds_md_join *)tail_lmm; - rc = llog_create(ctxt, &llh_tail, &tail_lmmj->lmmj_array_id, NULL); + rc = llog_create(ctxt,&llh_tail,&tail_lmmj->lmmj_array_id,NULL); if (rc) { CERROR("cannot open existing log, error = %d\n", rc); GOTO(cleanup, rc); diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index f688174..d49e5ca 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -954,14 +954,14 @@ int mds_open(struct mds_update_record *rec, int offset, LASSERT(dparent->d_inode != NULL); cleanup_phase = 1; /* parent dentry and lock */ - + if (rec->ur_flags & MDS_OPEN_JOIN_FILE) { dchild = dget(dparent); cleanup_phase = 2; /* child dentry */ acc_mode = accmode(dchild->d_inode, rec->ur_flags); GOTO(found_child, rc); } - + /* Step 2: Lookup the child */ dchild = ll_lookup_one_len(rec->ur_name, dparent, rec->ur_namelen - 1); if (IS_ERR(dchild)) { @@ -1052,7 +1052,6 @@ int mds_open(struct mds_update_record *rec, int offset, acc_mode = accmode(dchild->d_inode, rec->ur_flags); } - LASSERTF(!mds_inode_is_orphan(dchild->d_inode), "dchild %.*s (%p) inode %p/%lu/%u\n", dchild->d_name.len, dchild->d_name.name, dchild, dchild->d_inode, @@ -1118,7 +1117,7 @@ found_child: cleanup: rc = mds_finish_transno(mds, dchild ? dchild->d_inode : NULL, handle, req, rc, rep ? rep->lock_policy_res1 : 0); - + cleanup_no_trans: switch (cleanup_phase) { case 2: diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index d800547..91466ee 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -412,7 +412,7 @@ int mds_osc_setattr_async(struct obd_device *obd, struct inode *inode, if (rc) { CERROR("Error revalidate lsm %p \n", lsm); GOTO(out, rc); - } + } /* then fill oa */ oa->o_id = lsm->lsm_object_id; @@ -424,10 +424,10 @@ int mds_osc_setattr_async(struct obd_device *obd, struct inode *inode, oti.oti_logcookies = logcookies; } - LASSERT(fid != NULL); + LASSERT(fid != NULL); oa->o_fid = fid->id; oa->o_generation = fid->generation; - oa->o_valid |= OBD_MD_FLFID | OBD_MD_FLGENER; + oa->o_valid |= OBD_MD_FLFID | OBD_MD_FLGENER; /* do setattr from mds to ost asynchronously */ rc = obd_setattr_async(mds->mds_osc_exp, oa, lsm, &oti); @@ -464,7 +464,7 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset, int lmm_size = 0, need_lock = 1; int rc = 0, cleanup_phase = 0, err, locked = 0; unsigned int qcids[MAXQUOTAS] = {0, 0}; - unsigned int qpids[MAXQUOTAS] = {rec->ur_iattr.ia_uid, + unsigned int qpids[MAXQUOTAS] = {rec->ur_iattr.ia_uid, rec->ur_iattr.ia_gid}; ENTRY; @@ -483,8 +483,8 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset, if (req->rq_export->exp_connect_flags & OBD_CONNECT_RDONLY) GOTO(cleanup, rc = -EROFS); } else { - __u64 lockpart = MDS_INODELOCK_UPDATE; - if (rec->ur_iattr.ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID) ) + __u64 lockpart = MDS_INODELOCK_UPDATE; + if (rec->ur_iattr.ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) lockpart |= MDS_INODELOCK_LOOKUP; de = mds_fid2locked_dentry(obd, rec->ur_fid1, NULL, LCK_EX, @@ -634,8 +634,8 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset, err = mds_finish_transno(mds, inode, handle, req, rc, 0); /* do mds to ost setattr if needed */ if (!rc && !err && lmm_size) - mds_osc_setattr_async(obd, inode, lmm, lmm_size, - logcookies, rec->ur_fid1); + mds_osc_setattr_async(obd, inode, lmm, lmm_size, + logcookies, rec->ur_fid1); switch (cleanup_phase) { case 2: @@ -1010,7 +1010,7 @@ int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id, RETURN(-EIO); ldlm_lock_dump_handle(D_OTHER, handles[0]); - if (!memcmp(res_id[0], res_id[1], sizeof(*res_id[0])) && + if (memcmp(res_id[0], res_id[1], sizeof(*res_id[0])) == 0 && (policies[0]->l_inodebits.bits & policies[1]->l_inodebits.bits)) { memcpy(handles[1], handles[0], sizeof(*(handles[1]))); ldlm_lock_addref(handles[1], lock_modes[1]); @@ -1097,7 +1097,7 @@ int enqueue_4ordered_locks(struct obd_device *obd,struct ldlm_res_id *p1_res_id, if (res_id[i]->name[0] == 0) break; if (i != 0 && - !memcmp(res_id[i], res_id[i-1], sizeof(*res_id[i])) && + memcmp(res_id[i], res_id[i-1], sizeof(*res_id[i])) == 0 && (policies[i]->l_inodebits.bits & policies[i-1]->l_inodebits.bits)) { memcpy(dlm_handles[i], dlm_handles[i-1], @@ -2188,7 +2188,7 @@ int mds_reint_rec(struct mds_update_record *rec, int offset, #if CRAY_XT3 if (req->rq_uid != LNET_UID_ANY) { - /* non-root local cluster client + /* non-root local cluster client * NB root's creds are believed... */ LASSERT (req->rq_uid != 0); rec->ur_uc.luc_fsuid = req->rq_uid; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 27896a7..c653bac 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1958,15 +1958,15 @@ static int filter_getattr(struct obd_export *exp, struct obdo *oa, RETURN(rc); } -/* this should be enabled/disabled in condition to enabled/disabled large inodes - * in backing store FS. */ +/* this should be enabled/disabled in condition to enabled/disabled large + * inodes (fast EAs) in backing store FS. */ int filter_update_fidea(struct obd_export *exp, struct inode *inode, void *handle, struct obdo *oa) { struct obd_device *obd = exp->exp_obd; int rc = 0; ENTRY; - + if (oa->o_valid & OBD_MD_FLFID) { struct filter_fid ff; obd_gr group = 0; @@ -1974,9 +1974,9 @@ int filter_update_fidea(struct obd_export *exp, struct inode *inode, if (oa->o_valid & OBD_MD_FLGROUP) group = oa->o_gr; - /* packing fid and converting it to LE for storing into EA. Here - * ->o_stripe_idx should be filled by LOV and rest of fields - - * by client. */ + /* packing fid and converting it to LE for storing into EA. + * Here ->o_stripe_idx should be filled by LOV and rest of + * fields - by client. */ ff.ff_fid.id = cpu_to_le64(oa->o_fid); ff.ff_fid.f_type = cpu_to_le32(oa->o_stripe_idx); ff.ff_fid.generation = cpu_to_le32(oa->o_generation); @@ -1986,7 +1986,7 @@ int filter_update_fidea(struct obd_export *exp, struct inode *inode, CDEBUG(D_INODE, "storing filter fid EA ("LPU64"/%u/%u" LPU64"/"LPU64")\n", oa->o_fid, oa->o_stripe_idx, oa->o_generation, oa->o_id, group); - + rc = fsfilt_set_md(obd, inode, handle, &ff, sizeof(ff)); if (rc) CERROR("store fid in object failed! rc: %d\n", rc); @@ -2902,7 +2902,7 @@ static int filter_health_check(struct obd_device *obd) * health_check to return 0 on healthy * and 1 on unhealthy. */ - if(obd->u.obt.obt_sb->s_flags & MS_RDONLY) + if (obd->u.obt.obt_sb->s_flags & MS_RDONLY) rc = 1; LASSERT(filter->fo_health_check_filp != NULL); diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index da25e3c..abb39e1 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -638,7 +638,7 @@ cleanup: filter_iobuf_put(&exp->exp_obd->u.filter, iobuf, oti); case 2: pop_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL); - if (rc && dentry && !IS_ERR(dentry)) + if (rc) f_dput(dentry); break; case 1: diff --git a/lustre/obdfilter/filter_log.c b/lustre/obdfilter/filter_log.c index e6250f4..0dbd077 100644 --- a/lustre/obdfilter/filter_log.c +++ b/lustre/obdfilter/filter_log.c @@ -206,12 +206,6 @@ int filter_recov_log_mds_ost_cb(struct llog_handle *llh, CERROR("log is not plain\n"); RETURN(-EINVAL); } - if (rec->lrh_type != MDS_UNLINK_REC && - rec->lrh_type != MDS_SETATTR_REC && - rec->lrh_type != LLOG_GEN_REC) { - CERROR("log record type error\n"); - RETURN(-EINVAL); - } cookie.lgc_lgl = llh->lgh_id; cookie.lgc_subsys = LLOG_MDS_OST_ORIG_CTXT; @@ -234,7 +228,10 @@ int filter_recov_log_mds_ost_cb(struct llog_handle *llh, llog_cancel(ctxt, NULL, 1, &cookie, 0); RETURN(rc); } + break; default: + CERROR("log record type %08x unknown\n", rec->lrh_type); + RETURN(-EINVAL); break; } diff --git a/lustre/obdfilter/filter_lvb.c b/lustre/obdfilter/filter_lvb.c index 5f5eeaa..6673616 100644 --- a/lustre/obdfilter/filter_lvb.c +++ b/lustre/obdfilter/filter_lvb.c @@ -43,7 +43,6 @@ static int filter_lvbo_init(struct ldlm_resource *res) { struct ost_lvb *lvb = NULL; - struct filter_obd *filter; struct obd_device *obd; struct dentry *dentry; int rc = 0; @@ -68,7 +67,6 @@ static int filter_lvbo_init(struct ldlm_resource *res) res->lr_lvb_len = sizeof(*lvb); obd = res->lr_namespace->ns_lvbp; - filter = &obd->u.filter; LASSERT(obd != NULL); dentry = filter_fid2dentry(obd, NULL, 0, res->lr_name.name[0]); diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 2708414..dbc7dd1 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -132,7 +132,7 @@ static int ost_statfs(struct ptlrpc_request *req) req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs, jiffies-HZ); if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_ENOSPC)) - osfs->os_bfree = 64; + osfs->os_bfree = osfs->os_bavail = 64; if (req->rq_status != 0) CERROR("ost: statfs failed: rc %d\n", req->rq_status); diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index b44a60d..de0a21d 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -935,8 +935,8 @@ void lustre_swab_qdata(struct qunit_data *d) void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' - * running on Linux beetle 2.6.12-10-686 #1 Fri Nov 18 12:09:04 UTC 2005 i686 GNU/Linux - * with gcc version 3.3.6 (Ubuntu 1:3.3.6-8ubuntu1) */ + * running on Linux schatzie.adilger.int 2.6.12-1.1381_FC3 #1 Fri Oct 21 03:46:55 EDT 2005 i6 + * with gcc version 3.3.4 20040817 (Red Hat Linux 3.3.4-2) */ /* Constants... */ @@ -1780,8 +1780,10 @@ void lustre_assert_wire_constants(void) (long long)MDS_OPEN_DIRECTORY); LASSERTF(MDS_OPEN_DELAY_CREATE == 16777216, " found %lld\n", (long long)MDS_OPEN_DELAY_CREATE); - LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n", - (long long)MDS_OPEN_HAS_EA); + CLASSERT(MDS_OPEN_OWNEROVERRIDE == 0200000000); + CLASSERT(MDS_OPEN_JOIN_FILE == 0400000000); + CLASSERT(MDS_OPEN_HAS_EA == 010000000000); + CLASSERT(MDS_OPEN_HAS_OBJS == 020000000000); /* Checks for struct mds_rec_setattr */ LASSERTF((int)sizeof(struct mds_rec_setattr) == 96, " found %lld\n", diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index fd5a7a9..662ee10 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -869,7 +869,7 @@ test_27d() { mkdir -p $DIR/d27 $LSTRIPE $DIR/d27/fdef 0 -1 0 || error "lstripe failed" $CHECKSTAT -t file $DIR/d27/fdef || error "checkstat failed" - #dd if=/dev/zero of=$DIR/d27/fdef bs=4k count=4 || error + dd if=/dev/zero of=$DIR/d27/fdef bs=4k count=4 || error } run_test 27d "create file with default settings ================" @@ -1010,6 +1010,7 @@ test_27o() { reset_enospc rm -f $DIR/d27/f27o exhaust_all_precreations 0x215 + sleep 5 touch $DIR/d27/f27o && error @@ -2083,11 +2084,11 @@ test_54c() { tfile="$DIR/f54c" tdir="$DIR/d54c" loopdev="$DIR/loop54c" - + find_loop_dev [ -z "$LOOPNUM" ] && echo "couldn't find empty loop device" && return mknod $loopdev b 7 $LOOPNUM - echo "make a loop file system with $tfile on $loopdev ($LOOPNUM)..." + echo "make a loop file system with $tfile on $loopdev ($LOOPNUM)..." dd if=/dev/zero of=$tfile bs=`page_size` seek=1024 count=1 > /dev/null losetup $loopdev $tfile || error "can't set up $loopdev for $tfile" mkfs.ext2 $loopdev || error "mke2fs on $loopdev" @@ -2409,7 +2410,7 @@ test_65g() { $LSTRIPE $DIR/d65 $(($STRIPESIZE * 2)) 0 1 || error "setstripe" $LSTRIPE -d $DIR/d65 || error "setstripe" $LFS find -v $DIR/d65 | grep "$DIR/d65/ has no stripe info" || \ - error "delete default stripe failed" + error "delete default stripe failed" } run_test 65g "directory setstripe -d ===========================" @@ -2556,7 +2557,7 @@ test_71() { mkdir $DIR$LIB71 || error "can't create $DIR$LIB71" cp $LIB71/libc* $DIR$LIB71 || error "can't copy $LIB71/libc*" cp $LIB71/ld-* $DIR$LIB71 || error "can't create $LIB71/ld-*" - + echo "chroot $DIR /dbench -c client.txt 2" chroot $DIR /dbench -c client.txt 2 RC=$? @@ -2603,6 +2604,7 @@ run_test 74 "ldlm_enqueue freed-export error path (shouldn't LBUG)" JOIN=${JOIN:-"lfs join"} test_75() { rm -rf $DIR/f75* + dd if=/dev/urandom of=$DIR/f75_128k bs=1024 count=128 chmod 777 $DIR/f75_128k cp -p $DIR/f75_128k $DIR/f75_head @@ -2611,26 +2613,24 @@ test_75() { cat $DIR/f75_128k >> $DIR/f75_sim_sim $JOIN $DIR/f75_head $DIR/f75_tail || error "join error" - diff $DIR/f75_head $DIR/f75_sim_sim + diff $DIR/f75_head $DIR/f75_sim_sim diff -u $DIR/f75_head $DIR/f75_sim_sim || error "files are different" - ls $DIR/f75_tail && error "tail file still exist after join" - + $CHECKSTAT -a $DIR/f75_tail || error "tail file still exist after join" + cp -p $DIR/f75_128k $DIR/f75_tail cat $DIR/f75_sim_sim >> $DIR/f75_join_sim cat $DIR/f75_128k >> $DIR/f75_join_sim $JOIN $DIR/f75_head $DIR/f75_tail || error "join error" diff -u $DIR/f75_head $DIR/f75_join_sim diff -u $DIR/f75_head $DIR/f75_join_sim || error "files are different" - ls $DIR/f75_tail && error "tail file still exist after join" - + $CHECKSTAT -a $DIR/f75_tail || error "tail file still exist after join" - cp -p $DIR/f75_128k $DIR/f75_tail + cp -p $DIR/f75_128k $DIR/f75_tail cat $DIR/f75_128k >> $DIR/f75_sim_join cat $DIR/f75_join_sim >> $DIR/f75_sim_join $JOIN $DIR/f75_tail $DIR/f75_head || error "join error" - diff -u $DIR/f75_tail $DIR/f75_sim_join || error "files are different" - ls $DIR/f75_head && error "tail file still exist after join" - + diff -u $DIR/f75_tail $DIR/f75_sim_join || error "files are different" + $CHECKSTAT -a $DIR/f75_head || error "tail file still exist after join" cp -p $DIR/f75_128k $DIR/f75_head cp -p $DIR/f75_128k $DIR/f75_head_tmp @@ -2639,21 +2639,24 @@ test_75() { $JOIN $DIR/f75_head $DIR/f75_head_tmp || error "join error" $JOIN $DIR/f75_head $DIR/f75_tail || error "join error" diff -u $DIR/f75_head $DIR/f75_join_join || error "files are different" - ls $DIR/f75_head_tmp && error "tail file still exist after join" - ls $DIR/f75_tail && error "tail file still exist after join" + $CHECKSTAT -a $DIR/f75_head_tmp || error "tail file exist after join" + $CHECKSTAT -a $DIR/f75_tail || error "tail file still exist after join" rm -rf $DIR/f75_head || "delete join file error" - cp -p $DIR/f75_128k $DIR/f75_join_10_compare - cp -p $DIR/f75_128k $DIR/f75_join_10 + cp -p $DIR/f75_128k $DIR/f75_join_10_compare + cp -p $DIR/f75_128k $DIR/f75_join_10 for ((i=0;i<10;i++)); do cat $DIR/f75_128k >> $DIR/f75_join_10_compare cp -p $DIR/f75_128k $DIR/f75_tail $JOIN $DIR/f75_join_10 $DIR/f75_tail || error "join error" - ls $DIR/f75_tail && error "tail file exist after join" - done - diff -u $DIR/f75_join_10 $DIR/f75_join_10_compare || error "files are different" + $CHECKSTAT -a $DIR/f75_tail ||error "tail file exist after join" + done + diff -u $DIR/f75_join_10 $DIR/f75_join_10_compare || \ + error "files are different" $LFS getstripe $DIR/f75_join_10 - $OPENUNLINK $DIR/f75_join_10 $DIR/f75_join_10 || error "files unlink open" + $OPENUNLINK $DIR/f75_join_10 $DIR/f75_join_10||error "files unlink open" + + rm -rf $DIR/f75* } run_test 75 "TEST join file" diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index f192eda..25a1cc4 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -429,7 +429,7 @@ int lfs_join(int argc, char **argv) { char *name_head, *name_tail; int fd, rc; - off_t size; + loff_t size; if (argc != 3) return CMD_HELP; @@ -442,8 +442,8 @@ int lfs_join(int argc, char **argv) } size = lseek(fd, 0, SEEK_END); if (size % JOIN_FILE_ALIGN) { - fprintf(stderr, "head file %s size %llu must be mutiple of 4k\n", - name_head, size); + fprintf(stderr,"head file %s size %llu must be mutiple of %d\n", + name_head, size, JOIN_FILE_ALIGN); rc = -EINVAL; goto out; } diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 484ce27..2f68644 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -363,8 +363,8 @@ void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname, } } -void lov_dump_user_lmm_join(struct lov_user_md_v1 *lum, char *dname, - char *fname, int obdindex, int quiet, +void lov_dump_user_lmm_join(struct lov_user_md_v1 *lum, char *dname, + char *fname, int obdindex, int quiet, int header, int body) { struct lov_user_md_join *lumj = (struct lov_user_md_join *)lum; @@ -379,7 +379,7 @@ void lov_dump_user_lmm_join(struct lov_user_md_v1 *lum, char *dname, } } } else if (!quiet) { - printf("%s/%s (joined_file)\n", dname, fname); + printf("%s/%s\n", dname, fname); obdstripe = 1; } @@ -396,7 +396,8 @@ void lov_dump_user_lmm_join(struct lov_user_md_v1 *lum, char *dname, if (body) { unsigned long long start = -1, end = 0; if (!quiet && obdstripe == 1) - printf("\tobdidx\t\t objid\t\tobjid\t\t group\t\tstart\t\tend\n"); + printf("joined\tobdidx\t\t objid\t\tobjid\t\t group" + "\t\tstart\t\tend\n"); for (i = 0; i < lumj->lmm_stripe_count; i++) { int idx = lumj->lmm_objects[i].l_ost_idx; long long oid = lumj->lmm_objects[i].l_object_id; @@ -405,7 +406,7 @@ void lov_dump_user_lmm_join(struct lov_user_md_v1 *lum, char *dname, printf("\t%6u\t%14llu\t%#13llx\t%14llu%s", idx, oid, oid, gr, obdindex == idx ? " *" : ""); - if (start != lumj->lmm_objects[i].l_extent_start || + if (start != lumj->lmm_objects[i].l_extent_start || end != lumj->lmm_objects[i].l_extent_end) { start = lumj->lmm_objects[i].l_extent_start; printf("\t%14llu", start); @@ -426,14 +427,14 @@ void llapi_lov_dump_user_lmm(struct find_param *param, char *dname, char *fname) { switch(*(__u32 *)¶m->lmd->lmd_lmm) { /* lum->lmm_magic */ case LOV_USER_MAGIC_V1: - lov_dump_user_lmm_v1(¶m->lmd->lmd_lmm, dname, fname, - param->obdindex, param->quiet, + lov_dump_user_lmm_v1(¶m->lmd->lmd_lmm, dname, fname, + param->obdindex, param->quiet, param->verbose, (param->verbose || !param->obduuid)); break; case LOV_USER_MAGIC_JOIN: - lov_dump_user_lmm_join(¶m->lmd->lmd_lmm, dname, fname, - param->obdindex, param->quiet, + lov_dump_user_lmm_join(¶m->lmd->lmd_lmm, dname, fname, + param->obdindex, param->quiet, param->verbose, (param->verbose || !param->obduuid)); break; diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 5244770..53c0fda 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -20,13 +20,13 @@ do { \ #define STRINGIFY(a) #a -#if 0 -#define CHECK_DEFINE(a) \ - printf(" CLASSERT("#a" == "STRINGIFY(a) ");\n", (long long)a) -#define CHECK_VALUE(a) \ +#define CHECK_CDEFINE(a) \ + printf(" CLASSERT("#a" == "STRINGIFY(a) ");\n") + +#define CHECK_CVALUE(a) \ printf(" CLASSERT("#a" == %lld);\n", (long long)a) -#else + #define CHECK_DEFINE(a) \ do { \ printf(" LASSERTF("#a" == "STRINGIFY(a) \ @@ -47,7 +47,6 @@ do { \ " == %lldULL, \" found %%lld\\n\",\n "\ "(long long)"#a");\n", (long long)a); \ } while(0) -#endif #define CHECK_MEMBER_OFFSET(s,m) \ do { \ @@ -350,7 +349,10 @@ check_mds_body(void) CHECK_VALUE(MDS_OPEN_SYNC); CHECK_VALUE(MDS_OPEN_DIRECTORY); CHECK_VALUE(MDS_OPEN_DELAY_CREATE); - CHECK_VALUE(MDS_OPEN_HAS_EA); + CHECK_CDEFINE(MDS_OPEN_OWNEROVERRIDE); + CHECK_CDEFINE(MDS_OPEN_JOIN_FILE); + CHECK_CDEFINE(MDS_OPEN_HAS_EA); + CHECK_CDEFINE(MDS_OPEN_HAS_OBJS); } static void diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 0db15f0..d77c19e 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -26,8 +26,8 @@ int main() void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' - * running on Linux beetle 2.6.12-10-686 #1 Fri Nov 18 12:09:04 UTC 2005 i686 GNU/Linux - * with gcc version 3.3.6 (Ubuntu 1:3.3.6-8ubuntu1) */ + * running on Linux schatzie.adilger.int 2.6.12-1.1381_FC3 #1 Fri Oct 21 03:46:55 EDT 2005 i6 + * with gcc version 3.3.4 20040817 (Red Hat Linux 3.3.4-2) */ /* Constants... */ @@ -871,8 +871,10 @@ void lustre_assert_wire_constants(void) (long long)MDS_OPEN_DIRECTORY); LASSERTF(MDS_OPEN_DELAY_CREATE == 16777216, " found %lld\n", (long long)MDS_OPEN_DELAY_CREATE); - LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n", - (long long)MDS_OPEN_HAS_EA); + CLASSERT(MDS_OPEN_OWNEROVERRIDE == 0200000000); + CLASSERT(MDS_OPEN_JOIN_FILE == 0400000000); + CLASSERT(MDS_OPEN_HAS_EA == 010000000000); + CLASSERT(MDS_OPEN_HAS_OBJS == 020000000000); /* Checks for struct mds_rec_setattr */ LASSERTF((int)sizeof(struct mds_rec_setattr) == 96, " found %lld\n", -- 1.8.3.1