From 7e499228df5f9c39393ed003ff97c93a1f11c79f Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 9 Apr 2024 04:22:07 -0400 Subject: [PATCH] LU-12885 mds: add enums for MDS_OPEN flags This patch is first of the series of patch that separates kernel open flags from MDS open flags The first step is to add enum mds_open_flags to the code to make it easier to follow the logic. Rename it_flags to it_open_flags and use enum mds_open_flags in the code so it is clear that MDS_OPEN flags are being used. Signed-off-by: Andreas Dilger Change-Id: I933a6e6102f947a9276cb6bf03826fd4a53ebbe5 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/36469 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Arshad Hussain Reviewed-by: Jian Yu Reviewed-by: Timothy Day --- contrib/scripts/spelling.txt | 1 + lustre/include/lustre_intent.h | 2 +- lustre/include/obd.h | 2 +- lustre/include/uapi/linux/lustre/lustre_user.h | 106 +++++++++++-------------- lustre/llite/file.c | 43 +++++----- lustre/llite/namei.c | 12 +-- lustre/lmv/lmv_intent.c | 14 ++-- lustre/mdc/mdc_batch.c | 2 +- lustre/mdc/mdc_locks.c | 30 ++++--- lustre/mdt/mdt_open.c | 4 - lustre/ptlrpc/wiretest.c | 6 +- lustre/utils/wirecheck.c | 3 +- lustre/utils/wiretest.c | 6 +- 13 files changed, 106 insertions(+), 125 deletions(-) diff --git a/contrib/scripts/spelling.txt b/contrib/scripts/spelling.txt index ed1b29e..c490e84 100644 --- a/contrib/scripts/spelling.txt +++ b/contrib/scripts/spelling.txt @@ -52,6 +52,7 @@ from_timer||cfs_from_timer ft_nob||ft_bytes f_dentry||f_path.dentry [^_]get_seconds||ktime_get_real_seconds +it_flags||it_open_flags kmem_cache_alloc.*GFP_ZERO||kmem_cache_zalloc ldebugfs_remove||debugfs_remove_recursive ldlm_appetite_t||enum ldlm_appetite diff --git a/lustre/include/lustre_intent.h b/lustre/include/lustre_intent.h index 5f3a717..96ad670 100644 --- a/lustre/include/lustre_intent.h +++ b/lustre/include/lustre_intent.h @@ -37,7 +37,7 @@ struct lookup_intent { int it_op; int it_create_mode; - __u64 it_flags; + enum mds_open_flags it_open_flags; int it_disposition; int it_status; __u64 it_lock_handle; diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 62baa2a..2070da7 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -867,7 +867,7 @@ static inline int it_to_lock_mode(struct lookup_intent *it) else if (it->it_op & (IT_GETATTR | IT_OPEN | IT_LOOKUP)) return LCK_CR; else if (it->it_op & IT_LAYOUT) - return (it->it_flags & FMODE_WRITE) ? LCK_EX : LCK_CR; + return (it->it_open_flags & FMODE_WRITE) ? LCK_EX : LCK_CR; else if (it->it_op & IT_READDIR) return LCK_PR; else if (it->it_op & IT_GETXATTR) diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 84fd56f..e81b85f 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -1652,67 +1652,51 @@ enum la_valid { LA_REMOTE_ATTR_SET = (LA_UID | LA_GID | LA_PROJID | LA_LAYOUT_VERSION) }; -#define MDS_FMODE_READ 00000001 -#define MDS_FMODE_WRITE 00000002 - -#define MDS_FMODE_CLOSED 00000000 -#define MDS_FMODE_EXEC 00000004 -/* MDS_FMODE_EPOCH 01000000 obsolete since 2.8.0 */ -/* MDS_FMODE_TRUNC 02000000 obsolete since 2.8.0 */ -/* MDS_FMODE_SOM 04000000 obsolete since 2.8.0 */ - -#define MDS_OPEN_CREATED 00000010 -/* MDS_OPEN_CROSS 00000020 obsolete in 2.12, internal use only */ - -#define MDS_OPEN_CREAT 00000100 -#define MDS_OPEN_EXCL 00000200 -#define MDS_OPEN_TRUNC 00001000 -#define MDS_OPEN_APPEND 00002000 -#define MDS_OPEN_SYNC 00010000 -#define MDS_OPEN_DIRECTORY 00200000 - -#define MDS_OPEN_BY_FID 040000000 /* open_by_fid for known object */ -#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. - * We do not support JOIN FILE - * anymore, reserve this flags - * just for preventing such bit - * to be reused. - */ - -#define MDS_OPEN_LOCK 04000000000 /* This open requires open lock */ -#define MDS_OPEN_HAS_EA 010000000000 /* specify object create pattern */ -#define MDS_OPEN_HAS_OBJS 020000000000 /* Just set the EA the obj exist */ -#define MDS_OPEN_NORESTORE 0100000000000ULL /* Do not restore file at open */ -#define MDS_OPEN_NEWSTRIPE 0200000000000ULL /* New stripe needed (restripe or - * hsm restore) - */ -#define MDS_OPEN_VOLATILE 0400000000000ULL /* File is volatile = created - * linked - */ -#define MDS_OPEN_LEASE 01000000000000ULL /* Open the file and grant lease - * delegation, succeed if it's not - * being opened with conflict mode. - */ -#define MDS_OPEN_RELEASE 02000000000000ULL /* Open the file for HSM release */ - -#define MDS_OPEN_RESYNC 04000000000000ULL /* FLR: file resync */ -#define MDS_OPEN_PCC 010000000000000ULL /* PCC: auto RW-PCC cache attach - * for newly created file - */ -#define MDS_OP_WITH_FID 020000000000000ULL /* operation carried out by FID */ -#define MDS_OPEN_DEFAULT_LMV 040000000000000ULL /* open fetches default LMV, - * or mkdir with default LMV - */ - -/* lustre internal open flags, which should not be set from user space */ -#define MDS_OPEN_FL_INTERNAL (MDS_OPEN_HAS_EA | MDS_OPEN_HAS_OBJS | \ - MDS_OPEN_OWNEROVERRIDE | MDS_OPEN_LOCK | \ - MDS_OPEN_BY_FID | MDS_OPEN_LEASE | \ - MDS_OPEN_RELEASE | MDS_OPEN_RESYNC | \ - MDS_OPEN_PCC | MDS_OP_WITH_FID | \ - MDS_OPEN_DEFAULT_LMV) +enum mds_open_flags { + MDS_FMODE_CLOSED = 00000000, + MDS_FMODE_READ = 00000001, + MDS_FMODE_WRITE = 00000002, + MDS_FMODE_EXEC = 00000004, + MDS_OPEN_CREATED = 00000010, +/* MDS_OPEN_CROSS = 00000020, obsolete in 2.12, internal use only */ + MDS_OPEN_CREAT = 00000100, + MDS_OPEN_EXCL = 00000200, + MDS_OPEN_TRUNC = 00001000, + MDS_OPEN_APPEND = 00002000, + MDS_OPEN_SYNC = 00010000, + MDS_OPEN_DIRECTORY = 00200000, +/* MDS_FMODE_EPOCH = 01000000, obsolete in 2.8.0 */ +/* MDS_FMODE_TRUNC = 02000000, obsolete in 2.8.0 */ +/* MDS_FMODE_SOM = 04000000, obsolete in 2.8.0 */ + MDS_OPEN_BY_FID = 040000000, /* open_by_fid for known object */ + MDS_OPEN_DELAY_CREATE = 0100000000, /* delay initial object create */ + MDS_OPEN_OWNEROVERRIDE = 0200000000, /* NFSD rw-reopen ro file for owner */ +/* MDS_OPEN_JOIN_FILE = 0400000000, obsolete in 1.4 */ +/* FMODE_NONOTIFY = 0400000000, from OPEN_FMODE() */ + MDS_OPEN_LOCK = 04000000000, /* This requires open lock */ + MDS_OPEN_HAS_EA = 010000000000, /* specify obj create pattern */ + MDS_OPEN_HAS_OBJS = 020000000000, /* Just set EA, the obj exist */ + MDS_OPEN_NORESTORE = 0100000000000ULL, /* Dont restore file at open */ + /* New stripe needed (restripe or hsm restore) */ + MDS_OPEN_NEWSTRIPE = 0200000000000ULL, + MDS_OPEN_VOLATILE = 0400000000000ULL, /* File is volatile = created linked */ + /* Open file and grant lease delegaion, success if not being opened with conflict mode */ + MDS_OPEN_LEASE = 01000000000000ULL, + MDS_OPEN_RELEASE = 02000000000000ULL, /* Open file for HSM release */ + MDS_OPEN_RESYNC = 04000000000000ULL, /* FLR: file resync */ + /* PCC: auto RW-PCC cache attach for newly created file */ + MDS_OPEN_PCC = 010000000000000ULL, + MDS_OP_WITH_FID = 020000000000000ULL, /* operation carried out by FID */ + /* open fetches default LMV, or mkdir with default LMV */ + MDS_OPEN_DEFAULT_LMV = 040000000000000ULL, + /* lustre internal open flags, should not be set from user space */ + MDS_OPEN_FL_INTERNAL = (MDS_OPEN_HAS_EA | MDS_OPEN_HAS_OBJS | + MDS_OPEN_OWNEROVERRIDE | MDS_OPEN_PCC | + MDS_OPEN_BY_FID | MDS_OPEN_LEASE | + MDS_OPEN_RELEASE | MDS_OPEN_RESYNC | + MDS_OPEN_LOCK | MDS_OP_WITH_FID | + MDS_OPEN_DEFAULT_LMV), +}; /* mkdir fetches LMV, reuse bit of MDS_OPEN_RESYNC */ #define MDS_MKDIR_LMV MDS_OPEN_RESYNC diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 607d74e..2346077 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -663,7 +663,7 @@ static int ll_intent_file_open(struct dentry *de, void *lmm, int lmmsize, ENTRY; LASSERT(parent != NULL); - LASSERT(itp->it_flags & MDS_OPEN_BY_FID); + LASSERT(itp->it_open_flags & MDS_OPEN_BY_FID); /* if server supports open-by-fid, or file name is invalid, don't pack * name in open request */ @@ -787,7 +787,7 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it, och->och_fid = body->mbo_fid1; och->och_lease_handle.cookie = it->it_lock_handle; och->och_magic = OBD_CLIENT_HANDLE_MAGIC; - och->och_flags = it->it_flags; + och->och_flags = it->it_open_flags; return md_set_open_replay_data(md_exp, och, it); } @@ -812,7 +812,8 @@ static int ll_local_open(struct file *file, struct lookup_intent *it, file->private_data = fd; ll_readahead_init(inode, &fd->fd_ras); - fd->fd_omode = it->it_flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC); + fd->fd_omode = it->it_open_flags & (FMODE_READ | FMODE_WRITE | + FMODE_EXEC); RETURN(0); } @@ -857,7 +858,7 @@ int ll_file_open(struct inode *inode, struct file *file) { struct ll_inode_info *lli = ll_i2info(inode); struct lookup_intent *it, oit = { .it_op = IT_OPEN, - .it_flags = file->f_flags }; + .it_open_flags = file->f_flags }; struct obd_client_handle **och_p = NULL; __u64 *och_usecount = NULL; struct ll_file_data *fd; @@ -900,27 +901,27 @@ int ll_file_open(struct inode *inode, struct file *file) /* Convert f_flags into access mode. We cannot use file->f_mode, * because everything but O_ACCMODE mask was stripped from * there */ - if ((oit.it_flags + 1) & O_ACCMODE) - oit.it_flags++; + if ((oit.it_open_flags + 1) & O_ACCMODE) + oit.it_open_flags++; if (file->f_flags & O_TRUNC) - oit.it_flags |= FMODE_WRITE; + oit.it_open_flags |= FMODE_WRITE; /* kernel only call f_op->open in dentry_open. filp_open calls * dentry_open after call to open_namei that checks permissions. * Only nfsd_open call dentry_open directly without checking * permissions and because of that this code below is safe. */ - if (oit.it_flags & (FMODE_WRITE | FMODE_READ)) - oit.it_flags |= MDS_OPEN_OWNEROVERRIDE; + if (oit.it_open_flags & (FMODE_WRITE | FMODE_READ)) + oit.it_open_flags |= MDS_OPEN_OWNEROVERRIDE; /* We do not want O_EXCL here, presumably we opened the file * already? XXX - NFS implications? */ - oit.it_flags &= ~O_EXCL; + oit.it_open_flags &= ~O_EXCL; - /* bug20584, if "it_flags" contains O_CREAT, the file will be + /* bug20584, if "it_open_flags" contains O_CREAT, file will be * created if necessary, then "IT_CREAT" should be set to keep * consistent with it */ - if (oit.it_flags & O_CREAT) + if (oit.it_open_flags & O_CREAT) oit.it_op |= IT_CREAT; it = &oit; @@ -928,10 +929,10 @@ int ll_file_open(struct inode *inode, struct file *file) restart: /* Let's see if we have file open on MDS already. */ - if (it->it_flags & FMODE_WRITE) { + if (it->it_open_flags & FMODE_WRITE) { och_p = &lli->lli_mds_write_och; och_usecount = &lli->lli_open_fd_write_count; - } else if (it->it_flags & FMODE_EXEC) { + } else if (it->it_open_flags & FMODE_EXEC) { och_p = &lli->lli_mds_exec_och; och_usecount = &lli->lli_open_fd_exec_count; } else { @@ -1004,20 +1005,20 @@ restart: } else if (open_threshold > 0) { /* Take MDS_OPEN_LOCK with many opens */ if (lli->lli_open_fd_count >= open_threshold) - it->it_flags |= MDS_OPEN_LOCK; + it->it_open_flags |= MDS_OPEN_LOCK; /* If this is open after we just closed */ else if (ktime_before(ktime_get(), ktime_add_ms(lli->lli_close_fd_time, sbi->ll_oc_thrsh_ms))) - it->it_flags |= MDS_OPEN_LOCK; + it->it_open_flags |= MDS_OPEN_LOCK; } /* * Always specify MDS_OPEN_BY_FID because we don't want * to get file with different fid. */ - it->it_flags |= MDS_OPEN_BY_FID; + it->it_open_flags |= MDS_OPEN_BY_FID; rc = ll_intent_file_open(dentry, NULL, 0, it); if (rc) GOTO(out_openerr, rc); @@ -1252,8 +1253,8 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode, /* To tell the MDT this openhandle is from the same owner */ op_data->op_open_handle = old_open_handle; - it.it_flags = fmode | open_flags; - it.it_flags |= MDS_OPEN_LOCK | MDS_OPEN_BY_FID | MDS_OPEN_LEASE; + it.it_open_flags = fmode | open_flags; + it.it_open_flags |= MDS_OPEN_LOCK | MDS_OPEN_BY_FID | MDS_OPEN_LEASE; rc = md_intent_lock(sbi->ll_md_exp, op_data, &it, &req, &ll_md_blocking_lease_ast, /* LDLM_FL_NO_LRU: To not put the lease lock into LRU list, otherwise @@ -2686,7 +2687,7 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, { struct lookup_intent oit = { .it_op = IT_OPEN, - .it_flags = flags | MDS_OPEN_BY_FID, + .it_open_flags = flags | MDS_OPEN_BY_FID, }; int rc; ENTRY; @@ -6571,7 +6572,7 @@ static int ll_layout_intent(struct inode *inode, struct layout_intent *intent) it.it_op = IT_LAYOUT; if (intent->lai_opc == LAYOUT_INTENT_WRITE || intent->lai_opc == LAYOUT_INTENT_TRUNC) - it.it_flags = FMODE_WRITE; + it.it_open_flags = FMODE_WRITE; LDLM_DEBUG_NOLOCK("%s: requeue layout lock for file "DFID"(%p)", sbi->ll_fsname, PFID(&lli->lli_fid), inode); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 42d587a..b707de8 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -849,7 +849,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, RETURN(dentry == save ? NULL : dentry); } - if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE && + if (it->it_op & IT_OPEN && it->it_open_flags & FMODE_WRITE && dentry->d_sb->s_flags & SB_RDONLY) RETURN(ERR_PTR(-EROFS)); @@ -872,7 +872,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, op_data->op_fid2 = fid; op_data->op_bias = MDS_FID_OP; if (it->it_op & IT_OPEN) - it->it_flags |= MDS_OPEN_BY_FID; + it->it_open_flags |= MDS_OPEN_BY_FID; } /* enforce umask if acl disabled or MDS doesn't support umask */ @@ -1002,7 +1002,7 @@ inherit: op_data->op_data = lum; op_data->op_data_size = sizeof(*lum); op_data->op_archive_id = pca->pca_dataset->pccd_rwid; - it->it_flags |= MDS_OPEN_PCC; + it->it_open_flags |= MDS_OPEN_PCC; } rc = md_intent_lock(ll_i2mdexp(parent), op_data, it, &req, @@ -1229,8 +1229,8 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, } } it->it_create_mode = (mode & S_IALLUGO) | S_IFREG; - it->it_flags = (open_flags & ~O_ACCMODE) | OPEN_FMODE(open_flags); - it->it_flags &= ~MDS_OPEN_FL_INTERNAL; + it->it_open_flags = (open_flags & ~O_ACCMODE) | OPEN_FMODE(open_flags); + it->it_open_flags &= ~MDS_OPEN_FL_INTERNAL; if (ll_sbi_has_encrypt(ll_i2sbi(dir)) && IS_ENCRYPTED(dir)) { /* in case of create, this is going to be a regular file because @@ -1267,7 +1267,7 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, if (open_threshold == 1 && exp_connect_flags2(ll_i2mdexp(dir)) & OBD_CONNECT2_ATOMIC_OPEN_LOCK) - it->it_flags |= MDS_OPEN_LOCK; + it->it_open_flags |= MDS_OPEN_LOCK; /* Dentry added to dcache tree in ll_lookup_it */ de = ll_lookup_it(dir, dentry, it, &secctx, &secctxlen, &secctxslot, diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 0abf5e6..363f952 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -38,8 +38,8 @@ #include #include #include -#include +#include #include #include #include @@ -295,7 +295,7 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, struct lmv_obd *lmv = &obd->u.lmv; struct lmv_tgt_desc *tgt; struct mdt_body *body; - __u64 flags = it->it_flags; + __u64 flags = it->it_open_flags; int rc; ENTRY; @@ -328,13 +328,13 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, * layout first, to avoid creating new file * under old layout, clear O_CREAT. */ - it->it_flags &= ~O_CREAT; + it->it_open_flags &= ~O_CREAT; } } } retry: - if (it->it_flags & MDS_OPEN_BY_FID) { + if (it->it_open_flags & MDS_OPEN_BY_FID) { LASSERT(fid_is_sane(&op_data->op_fid2)); /* for striped directory, we can't know parent stripe fid @@ -360,7 +360,7 @@ retry: /* If it is ready to open the file by FID, do not need * allocate FID at all, otherwise it will confuse MDT */ - if ((it->it_op & IT_CREAT) && !(it->it_flags & MDS_OPEN_BY_FID)) { + if ((it->it_op & IT_CREAT) && !(it->it_open_flags & MDS_OPEN_BY_FID)) { /* * For lookup(IT_CREATE) cases allocate new fid and setup FLD * for it. @@ -385,14 +385,14 @@ retry: if ((it->it_disposition & DISP_LOOKUP_NEG) && !(it->it_disposition & DISP_OPEN_CREATE) && !(it->it_disposition & DISP_OPEN_OPEN)) { - if (!(it->it_flags & MDS_OPEN_BY_FID) && + if (!(it->it_open_flags & MDS_OPEN_BY_FID) && lmv_dir_retry_check_update(op_data)) { ptlrpc_req_put(*reqp); it->it_request = NULL; it->it_disposition = 0; *reqp = NULL; - it->it_flags = flags; + it->it_open_flags = flags; fid_zero(&op_data->op_fid2); goto retry; } diff --git a/lustre/mdc/mdc_batch.c b/lustre/mdc/mdc_batch.c index 82dff48..33d935d 100644 --- a/lustre/mdc/mdc_batch.c +++ b/lustre/mdc/mdc_batch.c @@ -126,7 +126,7 @@ static int mdc_batch_getattr_pack(struct batch_update_head *head, easize = MAX_MD_SIZE_OLD; /* obd->u.cli.cl_default_mds_easize; */ /* pack the intended request */ - mdc_getattr_pack(&pill, valid, it->it_flags, op_data, easize); + mdc_getattr_pack(&pill, valid, it->it_open_flags, op_data, easize); item->mop_lock_flags |= LDLM_FL_HAS_INTENT; rc = mdc_ldlm_lock_pack(head->buh_exp, &pill, &policy, diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index e5b3556..55f34f6 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -270,16 +270,17 @@ mdc_intent_open_pack(struct obd_export *exp, struct lookup_intent *it, /* XXX: openlock is not cancelled for cross-refs. */ /* If inode is known, cancel conflicting OPEN locks. */ if (fid_is_sane(&op_data->op_fid2)) { - if (it->it_flags & MDS_OPEN_LEASE) { /* try to get lease */ - if (it->it_flags & MDS_FMODE_WRITE) + if (it->it_open_flags & MDS_OPEN_LEASE) { /* try to get lease */ + if (it->it_open_flags & MDS_FMODE_WRITE) mode = LCK_EX; else mode = LCK_PR; } else { - if (it->it_flags & (MDS_FMODE_WRITE | MDS_OPEN_TRUNC)) + if (it->it_open_flags & (MDS_FMODE_WRITE | + MDS_OPEN_TRUNC)) mode = LCK_CW; #ifdef FMODE_EXEC - else if (it->it_flags & FMODE_EXEC) + else if (it->it_open_flags & FMODE_EXEC) mode = LCK_PR; #endif else @@ -308,7 +309,7 @@ mdc_intent_open_pack(struct obd_export *exp, struct lookup_intent *it, req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, op_data->op_namelen + 1); - if (cl_is_lov_delay_create(it->it_flags)) { + if (cl_is_lov_delay_create(it->it_open_flags)) { /* open(O_LOV_DELAY_CREATE) won't pack lmm */ LASSERT(lmmsize == 0); req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT, 0); @@ -349,7 +350,7 @@ mdc_intent_open_pack(struct obd_export *exp, struct lookup_intent *it, /* pack the intended request */ mdc_open_pack(&req->rq_pill, op_data, it->it_create_mode, 0, - it->it_flags, lmm, lmmsize, sepol); + it->it_open_flags, lmm, lmmsize, sepol); sptlrpc_sepol_put(sepol); @@ -660,7 +661,8 @@ mdc_intent_getattr_pack(struct obd_export *exp, struct lookup_intent *it, easize = obd->u.cli.cl_max_mds_easize; /* pack the intended request */ - mdc_getattr_pack(&req->rq_pill, valid, it->it_flags, op_data, easize); + mdc_getattr_pack(&req->rq_pill, valid, it->it_open_flags, op_data, + easize); req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, easize); req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER, acl_bufsize); @@ -715,7 +717,7 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp, RETURN(ERR_PTR(-ENOMEM)); if (fid_is_sane(&op_data->op_fid2) && (it->it_op & IT_LAYOUT) && - (it->it_flags & FMODE_WRITE)) { + (it->it_open_flags & FMODE_WRITE)) { count = mdc_resource_get_unused(exp, &op_data->op_fid2, &cancels, LCK_EX, MDS_INODELOCK_LAYOUT); @@ -989,7 +991,8 @@ static inline bool mdc_skip_mod_rpc_slot(const struct lookup_intent *it) if (it != NULL && (it->it_op == IT_GETATTR || it->it_op == IT_LOOKUP || it->it_op == IT_READDIR || it->it_op == IT_GETXATTR || - (it->it_op == IT_LAYOUT && !(it->it_flags & MDS_FMODE_WRITE)))) + (it->it_op == IT_LAYOUT && !(it->it_open_flags & + MDS_FMODE_WRITE)))) return true; return false; } @@ -1420,10 +1423,10 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, ENTRY; LASSERT(it); CDEBUG(D_DLMTRACE, "(name: %.*s,"DFID") in obj "DFID - ", intent: %s flags %#llo\n", (int)op_data->op_namelen, + ", intent: %s flags %#lo\n", (int)op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid2), PFID(&op_data->op_fid1), ldlm_it2str(it->it_op), - it->it_flags); + it->it_open_flags); lockh.cookie = 0; /* MDS_FID_OP is not a revalidate case */ @@ -1525,9 +1528,10 @@ int mdc_intent_getattr_async(struct obd_export *exp, ENTRY; CDEBUG(D_DLMTRACE, - "name: %.*s in inode "DFID", intent: %s flags %#llo\n", + "name: %.*s in inode "DFID", intent: %s flags %#lo\n", (int)op_data->op_namelen, op_data->op_name, - PFID(&op_data->op_fid1), ldlm_it2str(it->it_op), it->it_flags); + PFID(&op_data->op_fid1), ldlm_it2str(it->it_op), + it->it_open_flags); fid_build_reg_res_name(&op_data->op_fid1, &res_id); /* If the MDT return -ERANGE because of large ACL, then the sponsor diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 856a91b..0d668a8 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -1399,10 +1399,6 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc) LASSERT(info->mti_pill->rc_fmt == &RQF_LDLM_INTENT_OPEN); ldlm_rep = req_capsule_server_get(info->mti_pill, &RMF_DLM_REP); - if (unlikely(open_flags & MDS_OPEN_JOIN_FILE)) { - CERROR("file join is not supported anymore.\n"); - GOTO(out, result = err_serious(-EOPNOTSUPP)); - } msg_flags = lustre_msg_get_flags(req->rq_reqmsg); if ((open_flags & (MDS_OPEN_HAS_EA | MDS_OPEN_HAS_OBJS)) && diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index b80ce18..8ed8574 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -2738,14 +2738,12 @@ void lustre_assert_wire_constants(void) MDS_OPEN_DELAY_CREATE); LASSERTF(MDS_OPEN_OWNEROVERRIDE == 000200000000UL, "found 0%.11oUL\n", MDS_OPEN_OWNEROVERRIDE); - LASSERTF(MDS_OPEN_JOIN_FILE == 000400000000UL, "found 0%.11oUL\n", - MDS_OPEN_JOIN_FILE); LASSERTF(MDS_OPEN_LOCK == 004000000000UL, "found 0%.11oUL\n", MDS_OPEN_LOCK); LASSERTF(MDS_OPEN_HAS_EA == 010000000000UL, "found 0%.11oUL\n", MDS_OPEN_HAS_EA); - LASSERTF(MDS_OPEN_HAS_OBJS == 020000000000UL, "found 0%.11oUL\n", - MDS_OPEN_HAS_OBJS); + LASSERTF(MDS_OPEN_HAS_OBJS == 0000000000000020000000000UL, + "found 0%.22lloUL\n", (long long)MDS_OPEN_HAS_OBJS); LASSERTF(MDS_OPEN_NORESTORE == 00000000000100000000000ULL, "found 0%.22lloULL\n", (long long)MDS_OPEN_NORESTORE); LASSERTF(MDS_OPEN_NEWSTRIPE == 00000000000200000000000ULL, "found 0%.22lloULL\n", diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index a2e4175..1e0c0d6 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -1282,10 +1282,9 @@ check_mdt_body(void) CHECK_VALUE_O(MDS_OPEN_BY_FID); CHECK_VALUE_O(MDS_OPEN_DELAY_CREATE); CHECK_VALUE_O(MDS_OPEN_OWNEROVERRIDE); - CHECK_VALUE_O(MDS_OPEN_JOIN_FILE); CHECK_VALUE_O(MDS_OPEN_LOCK); CHECK_VALUE_O(MDS_OPEN_HAS_EA); - CHECK_VALUE_O(MDS_OPEN_HAS_OBJS); + CHECK_VALUE_64O(MDS_OPEN_HAS_OBJS); CHECK_VALUE_64O(MDS_OPEN_NORESTORE); CHECK_VALUE_64O(MDS_OPEN_NEWSTRIPE); CHECK_VALUE_64O(MDS_OPEN_VOLATILE); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 7bc2eb7..f881309 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -2762,14 +2762,12 @@ void lustre_assert_wire_constants(void) MDS_OPEN_DELAY_CREATE); LASSERTF(MDS_OPEN_OWNEROVERRIDE == 000200000000UL, "found 0%.11oUL\n", MDS_OPEN_OWNEROVERRIDE); - LASSERTF(MDS_OPEN_JOIN_FILE == 000400000000UL, "found 0%.11oUL\n", - MDS_OPEN_JOIN_FILE); LASSERTF(MDS_OPEN_LOCK == 004000000000UL, "found 0%.11oUL\n", MDS_OPEN_LOCK); LASSERTF(MDS_OPEN_HAS_EA == 010000000000UL, "found 0%.11oUL\n", MDS_OPEN_HAS_EA); - LASSERTF(MDS_OPEN_HAS_OBJS == 020000000000UL, "found 0%.11oUL\n", - MDS_OPEN_HAS_OBJS); + LASSERTF(MDS_OPEN_HAS_OBJS == 0000000000000020000000000UL, + "found 0%.22lloUL\n", (long long)MDS_OPEN_HAS_OBJS); LASSERTF(MDS_OPEN_NORESTORE == 00000000000100000000000ULL, "found 0%.22lloULL\n", (long long)MDS_OPEN_NORESTORE); LASSERTF(MDS_OPEN_NEWSTRIPE == 00000000000200000000000ULL, "found 0%.22lloULL\n", -- 1.8.3.1