From 55bd77d27d980b0c0dfccd5b6f618469d5cc01fc Mon Sep 17 00:00:00 2001 From: Eric Mei Date: Mon, 8 Feb 2010 16:24:46 -0700 Subject: [PATCH] b=16526 don't send raw inode flags on the wire. inode flags should be convert to platform-neutral MDS_*_FL before being sent on the wire. Also removed unused flags MDS_BFLAG_EXT_FLAGS. i=adilger --- lustre/include/lustre/lustre_idl.h | 24 ++++++++++-------------- lustre/llite/file.c | 3 ++- lustre/llite/llite_lib.c | 3 +-- lustre/mdc/mdc_lib.c | 2 +- lustre/mdc/mdc_request.c | 7 ++----- lustre/ptlrpc/wiretest.c | 1 - lustre/utils/wirecheck.c | 1 - lustre/utils/wiretest.c | 1 - 8 files changed, 16 insertions(+), 26 deletions(-) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index b8713d0..453d018 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1257,7 +1257,6 @@ enum md_op_flags { #define MF_SOM_LOCAL_FLAGS (MF_SOM_CHANGE | MF_EPOCH_OPEN | MF_EPOCH_CLOSE) #define MDS_BFLAG_UNCOMMITTED_WRITES 0x1 -#define MDS_BFLAG_EXT_FLAGS 0x80000000 /* == EXT3_RESERVED_FL */ /* these should be identical to their EXT3_*_FL counterparts, and are * redefined here only to avoid dragging in ext3_fs.h */ @@ -1268,29 +1267,26 @@ enum md_op_flags { #define MDS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (dir only) */ #ifdef __KERNEL__ -/* If MDS_BFLAG_IOC_FLAGS is set it means we requested EXT3_*_FL inode flags - * and we need to decode these into local S_* flags in the inode. Otherwise - * we pass flags straight through (see bug 9486). */ +/* Convert wire MDS_*_FL to corresponding client local VFS S_* values + * for the client inode i_flags. The MDS_*_FL are the Lustre wire + * protocol equivalents of LDISKFS_*_FL values stored on disk, while + * the S_* flags are kernel-internal values that change between kernel + * versions. These flags are set/cleared via FSFILT_IOC_{GET,SET}_FLAGS. + * See b=16526 for a full history. */ static inline int ll_ext_to_inode_flags(int flags) { - return (flags & MDS_BFLAG_EXT_FLAGS) ? - (((flags & MDS_SYNC_FL) ? S_SYNC : 0) | + return (((flags & MDS_SYNC_FL) ? S_SYNC : 0) | ((flags & MDS_NOATIME_FL) ? S_NOATIME : 0) | ((flags & MDS_APPEND_FL) ? S_APPEND : 0) | #if defined(S_DIRSYNC) ((flags & MDS_DIRSYNC_FL) ? S_DIRSYNC : 0) | #endif - ((flags & MDS_IMMUTABLE_FL) ? S_IMMUTABLE : 0)) : - (flags & ~MDS_BFLAG_EXT_FLAGS); + ((flags & MDS_IMMUTABLE_FL) ? S_IMMUTABLE : 0)); } -/* If MDS_BFLAG_EXT_FLAGS is set it means we requested EXT3_*_FL inode flags - * and we pass these straight through. Otherwise we need to convert from - * S_* flags to their EXT3_*_FL equivalents (see bug 9486). */ -static inline int ll_inode_to_ext_flags(int oflags, int iflags) +static inline int ll_inode_to_ext_flags(int iflags) { - return (oflags & MDS_BFLAG_EXT_FLAGS) ? (oflags & ~MDS_BFLAG_EXT_FLAGS): - (((iflags & S_SYNC) ? MDS_SYNC_FL : 0) | + return (((iflags & S_SYNC) ? MDS_SYNC_FL : 0) | ((iflags & S_NOATIME) ? MDS_NOATIME_FL : 0) | ((iflags & S_APPEND) ? MDS_APPEND_FL : 0) | #if defined(S_DIRSYNC) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index f452028..44eaaa2 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -75,7 +75,8 @@ void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data, op_data->op_attr.ia_ctime = inode->i_ctime; op_data->op_attr.ia_size = i_size_read(inode); op_data->op_attr_blocks = inode->i_blocks; - ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags = inode->i_flags; + ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags = + ll_inode_to_ext_flags(inode->i_flags); op_data->op_ioepoch = ll_i2info(inode)->lli_ioepoch; if (fh) op_data->op_handle = *fh; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index dad4ec2..549f72e 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1843,8 +1843,7 @@ int ll_iocontrol(struct inode *inode, struct file *file, EXIT; update_cache: - inode->i_flags = ll_ext_to_inode_flags(flags | - MDS_BFLAG_EXT_FLAGS); + inode->i_flags = ll_ext_to_inode_flags(flags); return 0; } default: diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index a76e408..db43656 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -447,7 +447,7 @@ void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, int flags, b->valid |= OBD_MD_FLCKSPLIT; if (op_data->op_bias & MDS_CROSS_REF) b->valid |= OBD_MD_FLCROSSREF; - b->flags = flags | MDS_BFLAG_EXT_FLAGS; + b->flags = flags; b->suppgid = op_data->op_suppgids[0]; b->fid1 = op_data->op_fid1; diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 0755097..b364881 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -223,8 +223,7 @@ int mdc_getattr(struct obd_export *exp, const struct lu_fid *fid, RETURN(rc); } - /* MDS_BFLAG_EXT_FLAGS: request "new" flags(bug 9486) */ - mdc_pack_body(req, fid, oc, valid, ea_size, -1, MDS_BFLAG_EXT_FLAGS); + mdc_pack_body(req, fid, oc, valid, ea_size, -1, 0); req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, ea_size); if (valid & OBD_MD_FLRMTPERM) { @@ -266,9 +265,7 @@ int mdc_getattr_name(struct obd_export *exp, const struct lu_fid *fid, RETURN(rc); } - /* MDS_BFLAG_EXT_FLAGS: request "new" flags(bug 9486) */ - mdc_pack_body(req, fid, oc, valid, ea_size, suppgid, - MDS_BFLAG_EXT_FLAGS); + mdc_pack_body(req, fid, oc, valid, ea_size, suppgid, 0); if (filename) { char *name = req_capsule_client_get(&req->rq_pill, &RMF_NAME); diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 83f57f8..286b4e6 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1168,7 +1168,6 @@ void lustre_assert_wire_constants(void) CLASSERT(MDS_APPEND_FL == 0x00000020); CLASSERT(MDS_NOATIME_FL == 0x00000080); CLASSERT(MDS_DIRSYNC_FL == 0x00010000); - CLASSERT(MDS_BFLAG_EXT_FLAGS == 0x80000000); CLASSERT(MDS_INODELOCK_LOOKUP == 0x000001); CLASSERT(MDS_INODELOCK_UPDATE == 0x000002); CLASSERT(MDS_INODELOCK_OPEN == 0x000004); diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index a94c874..49092b1 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -536,7 +536,6 @@ check_mds_body(void) CHECK_CDEFINE(MDS_APPEND_FL); CHECK_CDEFINE(MDS_NOATIME_FL); CHECK_CDEFINE(MDS_DIRSYNC_FL); - CHECK_CDEFINE(MDS_BFLAG_EXT_FLAGS); CHECK_CDEFINE(MDS_INODELOCK_LOOKUP); CHECK_CDEFINE(MDS_INODELOCK_UPDATE); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 828c5f4..8644e27 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1165,7 +1165,6 @@ void lustre_assert_wire_constants(void) CLASSERT(MDS_APPEND_FL == 0x00000020); CLASSERT(MDS_NOATIME_FL == 0x00000080); CLASSERT(MDS_DIRSYNC_FL == 0x00010000); - CLASSERT(MDS_BFLAG_EXT_FLAGS == 0x80000000); CLASSERT(MDS_INODELOCK_LOOKUP == 0x000001); CLASSERT(MDS_INODELOCK_UPDATE == 0x000002); CLASSERT(MDS_INODELOCK_OPEN == 0x000004); -- 1.8.3.1