From 1d2beb8553a822cbfa9ddd602e399f7883473586 Mon Sep 17 00:00:00 2001 From: tianzy Date: Fri, 13 Mar 2009 11:09:27 +0000 Subject: [PATCH 1/1] Branch HEAD change O_CHECK_STALE to M_CHECK_STALE so that doesn't conflict with VFS flags. b=16277 i=green i=adilger --- lustre/include/lustre/lustre_user.h | 4 ---- lustre/include/lustre_mds.h | 5 +++++ lustre/llite/dcache.c | 4 ++-- lustre/llite/file.c | 11 ++++++----- lustre/mdc/mdc_internal.h | 1 + lustre/mdc/mdc_lib.c | 6 +++--- lustre/mdc/mdc_locks.c | 12 ++++++------ 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index b942a63..daa4b4e 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -119,11 +119,7 @@ struct obd_statfs; #define LL_IOC_OBD_STATFS IOC_OBD_STATFS #define IOC_MDC_GETSTRIPE IOC_MDC_GETFILESTRIPE -/* Do not define O_CHECK_STALE as 0200000000, - * which is conflict with MDS_OPEN_OWNEROVERRIDE */ -#define O_CHECK_STALE 020000000 /* hopefully this does not conflict */ #define O_LOV_DELAY_CREATE 0100000000 /* 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/include/lustre_mds.h b/lustre/include/lustre_mds.h index dac9f11..c427feb 100644 --- a/lustre/include/lustre_mds.h +++ b/lustre/include/lustre_mds.h @@ -81,4 +81,9 @@ static inline int md_should_create(__u32 flags) !(flags & FMODE_WRITE)); } +/* these are local flags, used only on the client, private */ +#define M_CHECK_STALE 0200000000 +#define M_JOIN_FILE 0400000000 /* its counterpart is + * MDS_OPEN_JOIN_FILE */ + #endif diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 0f7c7e6..985fff7 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -470,11 +470,11 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags, do_lock: it->it_create_mode &= ~current->fs->umask; - it->it_flags |= O_CHECK_STALE; + it->it_create_mode |= M_CHECK_STALE; rc = md_intent_lock(exp, op_data, NULL, 0, it, lookup_flags, &req, ll_md_blocking_ast, 0); - it->it_flags &= ~O_CHECK_STALE; + it->it_create_mode &= ~M_CHECK_STALE; ll_finish_md_op_data(op_data); if (it->it_op == IT_GETATTR && !first) /* If there are too many locks on client-side, then some diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 7a8c316..79203b8 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -607,9 +607,9 @@ restart: would attempt to grab och_sem as well, that would result in a deadlock */ up(&lli->lli_och_sem); - it->it_flags |= O_CHECK_STALE; + it->it_create_mode |= M_CHECK_STALE; rc = ll_intent_file_open(file, NULL, 0, it); - it->it_flags &= ~O_CHECK_STALE; + it->it_create_mode &= ~M_CHECK_STALE; if (rc) { ll_file_data_put(fd); GOTO(out_openerr, rc); @@ -1464,7 +1464,8 @@ static int join_file(struct inode *head_inode, struct file *head_filp, { struct dentry *tail_dentry = tail_filp->f_dentry; struct lookup_intent oit = {.it_op = IT_OPEN, - .it_flags = head_filp->f_flags|O_JOIN_FILE}; + .it_flags = head_filp->f_flags, + .it_create_mode = M_JOIN_FILE}; struct ldlm_enqueue_info einfo = { LDLM_IBITS, LCK_CW, ll_md_blocking_ast, ldlm_completion_ast, NULL, NULL, NULL }; @@ -2177,14 +2178,14 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it) if (IS_ERR(op_data)) RETURN(PTR_ERR(op_data)); - oit.it_flags |= O_CHECK_STALE; + oit.it_create_mode |= M_CHECK_STALE; rc = md_intent_lock(exp, op_data, NULL, 0, /* we are not interested in name based lookup */ &oit, 0, &req, ll_md_blocking_ast, 0); ll_finish_md_op_data(op_data); - oit.it_flags &= ~O_CHECK_STALE; + oit.it_create_mode &= ~M_CHECK_STALE; if (rc < 0) { rc = ll_inode_revalidate_fini(inode, rc); GOTO (out, rc); diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index 00092f4..85164a0 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -38,6 +38,7 @@ #define _MDC_INTERNAL_H #include +#include #ifdef LPROCFS void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars); diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 7094b5a..d62321c 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -164,7 +164,7 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data, } } -static __u32 mds_pack_open_flags(__u32 flags) +static __u32 mds_pack_open_flags(__u32 flags, __u32 mode) { __u32 cr_flags = (flags & (FMODE_READ | FMODE_WRITE | MDS_OPEN_HAS_EA | MDS_OPEN_HAS_OBJS | @@ -181,7 +181,7 @@ static __u32 mds_pack_open_flags(__u32 flags) cr_flags |= MDS_OPEN_SYNC; if (flags & O_DIRECTORY) cr_flags |= MDS_OPEN_DIRECTORY; - if (flags & O_JOIN_FILE) + if (mode & M_JOIN_FILE) cr_flags |= MDS_OPEN_JOIN_FILE; #ifdef FMODE_EXEC if (flags & FMODE_EXEC) @@ -226,7 +226,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, rec->cr_fid2 = op_data->op_fid2; } rec->cr_mode = mode; - rec->cr_flags = mds_pack_open_flags(flags); + rec->cr_flags = mds_pack_open_flags(flags, mode); rec->cr_rdev = rdev; rec->cr_time = op_data->op_mod_time; rec->cr_suppgid1 = op_data->op_suppgids[0]; diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 10bd3f5..2f22f1a 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -241,8 +241,8 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp, struct ptlrpc_request *req; struct obd_device *obddev = class_exp2obd(exp); struct ldlm_intent *lit; - int joinfile = !!((it->it_flags & O_JOIN_FILE) && - op_data->op_data); + int joinfile = !!((it->it_create_mode & M_JOIN_FILE) && + op_data->op_data); CFS_LIST_HEAD(cancels); int count = 0; int mode; @@ -630,7 +630,7 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, policy = *(ldlm_policy_data_t *)lmm; res_id.name[3] = LDLM_FLOCK; } else if (it->it_op & IT_OPEN) { - int joinfile = !!((it->it_flags & O_JOIN_FILE) && + int joinfile = !!((it->it_create_mode & M_JOIN_FILE) && op_data->op_data); req = mdc_intent_open_pack(exp, it, op_data, lmm, lmmsize, @@ -640,7 +640,7 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, einfo->ei_cbdata = NULL; lmm = NULL; } else - it->it_flags &= ~O_JOIN_FILE; + it->it_create_mode &= ~M_JOIN_FILE; } else if (it->it_op & IT_UNLINK) req = mdc_intent_unlink_pack(exp, it, op_data); else if (it->it_op & (IT_GETATTR | IT_LOOKUP)) @@ -723,7 +723,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp, /* If we were revalidating a fid/name pair, mark the intent in * case we fail and get called again from lookup */ if (fid_is_sane(&op_data->op_fid2) && - it->it_flags & O_CHECK_STALE && + it->it_create_mode & M_CHECK_STALE && it->it_op != IT_GETATTR) { it_set_disposition(it, DISP_ENQ_COMPLETE); @@ -911,7 +911,7 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, if (rc < 0) RETURN(rc); } else if (!fid_is_sane(&op_data->op_fid2) || - !(it->it_flags & O_CHECK_STALE)) { + !(it->it_create_mode & M_CHECK_STALE)) { /* DISP_ENQ_COMPLETE set means there is extra reference on * request referenced from this intent, saved for subsequent * lookup. This path is executed when we proceed to this -- 1.8.3.1