Whamcloud - gitweb
LU-10030 clio: don't use spare bits in iattr.ia_valid 25/32825/15
authorJames Simmons <uja.ornl@yahoo.com>
Fri, 21 Sep 2018 02:18:09 +0000 (22:18 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 5 Oct 2018 22:26:44 +0000 (22:26 +0000)
Using spare bits in iattr.ia_valid is not safe as the
bits might get used for some other purpose without
us noticing.

Lustre currently used 4 spare bit, but they are all
defined in different places so this isn't immediately
obvious.

This patch brings all those bit definitions together
and defined a new op_data field (op_xvalid) to hold
the extra validity bits.

It also replaces sa_valid in struct cl_setattr_io
with sa_avalid and sa_xvalid.  Changing the name is
helpful as sa_valid already has another use within
lustre.

Modified version of:
Linux-commit: 599b9fb8d424c7907325037b5a862221b1232526

Change-Id: I475a16d557143c0741472e5873c83d71968d7cb8
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/32825
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Tested-by: Jenkins
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
14 files changed:
lustre/include/cl_object.h
lustre/include/lustre_compat.h
lustre/include/lustre_patchless_compat.h
lustre/include/obd.h
lustre/llite/file.c
lustre/llite/lcommon_cl.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/vvp_io.c
lustre/lmv/lmv_obd.c
lustre/lov/lov_io.c
lustre/mdc/mdc_dev.c
lustre/mdc/mdc_lib.c
lustre/osc/osc_io.c

index 789e0d7..bf031e4 100644 (file)
@@ -1818,7 +1818,8 @@ struct cl_io {
                struct cl_setattr_io {
                        struct ost_lvb           sa_attr;
                        unsigned int             sa_attr_flags;
-                       unsigned int             sa_valid;
+                       unsigned int             sa_avalid; /* ATTR_* */
+                       unsigned int             sa_xvalid; /* OP_XVALID */
                        int                      sa_stripe_index;
                        struct ost_layout        sa_layout;
                        const struct lu_fid     *sa_parent_fid;
@@ -2381,8 +2382,8 @@ static inline int cl_io_is_mkwrite(const struct cl_io *io)
  */
 static inline int cl_io_is_trunc(const struct cl_io *io)
 {
-        return io->ci_type == CIT_SETATTR &&
-                (io->u.ci_setattr.sa_valid & ATTR_SIZE);
+       return io->ci_type == CIT_SETATTR &&
+               (io->u.ci_setattr.sa_avalid & ATTR_SIZE);
 }
 
 struct cl_io *cl_io_top(struct cl_io *io);
index 3930c6f..7ca150b 100644 (file)
@@ -82,12 +82,6 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
                path_put(&old_pwd);
 }
 
-/*
- * set ATTR_BLOCKS to a high value to avoid any risk of collision with other
- * ATTR_* attributes (see bug 13828)
- */
-#define ATTR_BLOCKS    (1 << 27)
-
 #define current_ngroups current_cred()->group_info->ngroups
 #define current_groups current_cred()->group_info->small_block
 
index 2ad8bce..fd7f82d 100644 (file)
@@ -123,14 +123,6 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
 #define ATTR_RAW 0
 #endif
 
-#ifndef ATTR_CTIME_SET
-/*
- * set ATTR_CTIME_SET to a high value to avoid any risk of collision with other
- * ATTR_* attributes (see bug 13828)
- */
-#define ATTR_CTIME_SET (1 << 28)
-#endif
-
 #ifndef HAVE_IN_COMPAT_SYSCALL
 #define in_compat_syscall      is_compat_task
 #endif
index 99c46a1..b35b3fa 100644 (file)
@@ -775,6 +775,17 @@ struct obd_device {
 #define KEY_CACHE_LRU_SHRINK   "cache_lru_shrink"
 #define KEY_OSP_CONNECTED      "osp_connected"
 
+/* Flags for op_xvalid */
+enum op_xvalid {
+       OP_XVALID_CTIME_SET     = BIT(0),       /* 0x0001 */
+       OP_XVALID_BLOCKS        = BIT(1),       /* 0x0002 */
+       OP_XVALID_OWNEROVERRIDE = BIT(2),       /* 0x0004 */
+       OP_XVALID_FLAGS         = BIT(3),       /* 0x0008 */
+       OP_XVALID_PROJID        = BIT(4),       /* 0x0010 */
+       OP_XVALID_LAZYSIZE      = BIT(5),       /* 0x0020 */
+       OP_XVALID_LAZYBLOCKS    = BIT(6),       /* 0x0040 */
+};
+
 struct lu_context;
 
 static inline int it_to_lock_mode(struct lookup_intent *it)
@@ -843,9 +854,10 @@ struct md_op_data {
 
        /* iattr fields and blocks. */
        struct iattr            op_attr;
+       enum op_xvalid          op_xvalid;      /* eXtra validity flags */
        loff_t                  op_attr_blocks;
-       __u64                   op_valid; /* OBD_MD_* */
-       unsigned int            op_attr_flags; /* LUSTRE_{SYNC,..}_FL */
+       u64                     op_valid;       /* OBD_MD_* */
+       unsigned int            op_attr_flags;  /* LUSTRE_{SYNC,..}_FL */
 
        enum md_op_flags        op_flags;
 
index 0481138..2bcab21 100644 (file)
@@ -99,9 +99,10 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data,
        op_data->op_attr.ia_mtime = inode->i_mtime;
        op_data->op_attr.ia_ctime = inode->i_ctime;
        op_data->op_attr.ia_size = i_size_read(inode);
-       op_data->op_attr.ia_valid |= ATTR_MODE | ATTR_ATIME | ATTR_ATIME_SET |
-                                    ATTR_MTIME | ATTR_MTIME_SET |
-                                    ATTR_CTIME | ATTR_CTIME_SET;
+       op_data->op_attr.ia_valid |= (ATTR_MODE | ATTR_ATIME | ATTR_ATIME_SET |
+                                     ATTR_MTIME | ATTR_MTIME_SET |
+                                     ATTR_CTIME);
+       op_data->op_xvalid |= OP_XVALID_CTIME_SET;
        op_data->op_attr_blocks = inode->i_blocks;
        op_data->op_attr_flags = ll_inode_to_ext_flags(inode->i_flags);
        if (ll_file_test_flag(ll_i2info(inode), LLIF_PROJECT_INHERIT))
@@ -154,7 +155,8 @@ static int ll_close_inode_openhandle(struct inode *inode,
        case MDS_CLOSE_LAYOUT_MERGE:
                /* merge blocks from the victim inode */
                op_data->op_attr_blocks += ((struct inode *)data)->i_blocks;
-               op_data->op_attr.ia_valid |= ATTR_SIZE | ATTR_BLOCKS;
+               op_data->op_attr.ia_valid |= ATTR_SIZE;
+               op_data->op_xvalid |= OP_XVALID_BLOCKS;
        case MDS_CLOSE_LAYOUT_SPLIT:
        case MDS_CLOSE_LAYOUT_SWAP: {
                struct split_param *sp = data;
@@ -178,7 +180,8 @@ static int ll_close_inode_openhandle(struct inode *inode,
                LASSERT(data != NULL);
                op_data->op_attr_blocks +=
                        ioc->lil_count * op_data->op_attr_blocks;
-               op_data->op_attr.ia_valid |= ATTR_SIZE | ATTR_BLOCKS;
+               op_data->op_attr.ia_valid |= ATTR_SIZE;
+               op_data->op_xvalid |= OP_XVALID_BLOCKS;
                op_data->op_bias |= MDS_CLOSE_RESYNC_DONE;
 
                op_data->op_lease_handle = och->och_lease_handle;
@@ -193,7 +196,8 @@ static int ll_close_inode_openhandle(struct inode *inode,
                op_data->op_bias |= MDS_HSM_RELEASE;
                op_data->op_data_version = *(__u64 *)data;
                op_data->op_lease_handle = och->och_lease_handle;
-               op_data->op_attr.ia_valid |= ATTR_SIZE | ATTR_BLOCKS;
+               op_data->op_attr.ia_valid |= ATTR_SIZE;
+               op_data->op_xvalid |= OP_XVALID_BLOCKS;
                break;
 
        default:
@@ -202,9 +206,9 @@ static int ll_close_inode_openhandle(struct inode *inode,
        }
 
        if (!(op_data->op_attr.ia_valid & ATTR_SIZE))
-               op_data->op_attr.ia_valid |= MDS_ATTR_LSIZE;
-       if (!(op_data->op_attr.ia_valid & ATTR_BLOCKS))
-               op_data->op_attr.ia_valid |= MDS_ATTR_LBLOCKS;
+               op_data->op_xvalid |= OP_XVALID_LAZYSIZE;
+       if (!(op_data->op_xvalid & OP_XVALID_BLOCKS))
+               op_data->op_xvalid |= OP_XVALID_LAZYBLOCKS;
 
        rc = md_close(md_exp, op_data, och->och_mod, &req);
        if (rc != 0 && rc != -EINTR)
@@ -2745,7 +2749,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file,
 
        inode_lock(inode);
 
-       rc = ll_setattr_raw(file_dentry(file), attr, true);
+       rc = ll_setattr_raw(file_dentry(file), attr, 0, true);
        if (rc == -ENODATA)
                rc = 0;
 
@@ -2773,7 +2777,7 @@ static int ll_file_futimes_3(struct file *file, const struct ll_futimes_3 *lfu)
        struct iattr ia = {
                .ia_valid = ATTR_ATIME | ATTR_ATIME_SET |
                            ATTR_MTIME | ATTR_MTIME_SET |
-                           ATTR_CTIME | ATTR_CTIME_SET,
+                           ATTR_CTIME,
                .ia_atime = {
                        .tv_sec = lfu->lfu_atime_sec,
                        .tv_nsec = lfu->lfu_atime_nsec,
@@ -2797,7 +2801,8 @@ static int ll_file_futimes_3(struct file *file, const struct ll_futimes_3 *lfu)
                RETURN(-EINVAL);
 
        inode_lock(inode);
-       rc = ll_setattr_raw(file_dentry(file), &ia, false);
+       rc = ll_setattr_raw(file_dentry(file), &ia, OP_XVALID_CTIME_SET,
+                           false);
        inode_unlock(inode);
 
        RETURN(rc);
@@ -3096,7 +3101,7 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd,
        if (fsxattr.fsx_xflags & FS_XFLAG_PROJINHERIT)
                op_data->op_attr_flags |= LUSTRE_PROJINHERIT_FL;
        op_data->op_projid = fsxattr.fsx_projid;
-       op_data->op_attr.ia_valid |= (MDS_ATTR_PROJID | ATTR_ATTR_FLAG);
+       op_data->op_xvalid |= OP_XVALID_PROJID | OP_XVALID_FLAGS;
        rc = md_setattr(ll_i2sbi(inode)->ll_md_exp, op_data, NULL,
                        0, &req);
        ptlrpc_req_finished(req);
@@ -3111,8 +3116,8 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd,
        if (attr == NULL)
                GOTO(out_fsxattr, rc = -ENOMEM);
 
-       attr->ia_valid = ATTR_ATTR_FLAG;
-       rc = cl_setattr_ost(obj, attr, fsxattr.fsx_xflags);
+       rc = cl_setattr_ost(obj, attr, OP_XVALID_FLAGS,
+                           fsxattr.fsx_xflags);
        OBD_FREE_PTR(attr);
 out_fsxattr:
        ll_finish_md_op_data(op_data);
index 597c130..010b6cc 100644 (file)
@@ -68,7 +68,7 @@ __u16 cl_inode_fini_refcheck;
 static DEFINE_MUTEX(cl_inode_fini_guard);
 
 int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr,
-                  unsigned int attr_flags)
+                  enum op_xvalid xvalid, unsigned int attr_flags)
 {
         struct lu_env *env;
         struct cl_io  *io;
@@ -90,7 +90,8 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr,
        io->u.ci_setattr.sa_attr.lvb_ctime = LTIME_S(attr->ia_ctime);
        io->u.ci_setattr.sa_attr.lvb_size = attr->ia_size;
        io->u.ci_setattr.sa_attr_flags = attr_flags;
-       io->u.ci_setattr.sa_valid = attr->ia_valid;
+       io->u.ci_setattr.sa_avalid = attr->ia_valid;
+       io->u.ci_setattr.sa_xvalid = xvalid;
        io->u.ci_setattr.sa_parent_fid = lu_object_fid(&obj->co_lu);
 
 again:
index bca1084..b832fd3 100644 (file)
@@ -923,7 +923,8 @@ void ll_kill_super(struct super_block *sb);
 struct inode *ll_inode_from_resource_lock(struct ldlm_lock *lock);
 void ll_dir_clear_lsm_md(struct inode *inode);
 void ll_clear_inode(struct inode *inode);
-int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import);
+int ll_setattr_raw(struct dentry *dentry, struct iattr *attr,
+                  enum op_xvalid xvalid, bool hsm_import);
 int ll_setattr(struct dentry *de, struct iattr *attr);
 int ll_statfs(struct dentry *de, struct kstatfs *sfs);
 int ll_statfs_internal(struct ll_sb_info *sbi, struct obd_statfs *osfs,
@@ -1457,7 +1458,7 @@ int ll_getparent(struct file *file, struct getparent __user *arg);
 
 /* lcommon_cl.c */
 int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr,
-                  unsigned int attr_flags);
+                  enum op_xvalid xvalid, unsigned int attr_flags);
 
 extern struct lu_env *cl_inode_fini_env;
 extern __u16 cl_inode_fini_refcheck;
index 868c340..8c82dd8 100644 (file)
@@ -1613,7 +1613,8 @@ static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data)
  *
  * In case of HSMimport, we only set attr on MDS.
  */
-int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
+int ll_setattr_raw(struct dentry *dentry, struct iattr *attr,
+                  enum op_xvalid xvalid, bool hsm_import)
 {
         struct inode *inode = dentry->d_inode;
         struct ll_inode_info *lli = ll_i2info(inode);
@@ -1653,12 +1654,12 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
                        RETURN(-EPERM);
        }
 
-        /* We mark all of the fields "set" so MDS/OST does not re-set them */
-       if (!(attr->ia_valid & ATTR_CTIME_SET) &&
-           (attr->ia_valid & ATTR_CTIME)) {
+       /* We mark all of the fields "set" so MDS/OST does not re-set them */
+       if (!(xvalid & OP_XVALID_CTIME_SET) &&
+            (attr->ia_valid & ATTR_CTIME)) {
                attr->ia_ctime = current_time(inode);
-                attr->ia_valid |= ATTR_CTIME_SET;
-        }
+               xvalid |= OP_XVALID_CTIME_SET;
+       }
        if (!(attr->ia_valid & ATTR_ATIME_SET) &&
            (attr->ia_valid & ATTR_ATIME)) {
                attr->ia_atime = current_time(inode);
@@ -1690,8 +1691,9 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
 
        if (!hsm_import && attr->ia_valid & ATTR_SIZE) {
                /* If we are changing file size, file content is
-                * modified, flag it. */
-               attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE;
+                * modified, flag it.
+                */
+               xvalid |= OP_XVALID_OWNEROVERRIDE;
                op_data->op_bias |= MDS_DATA_MODIFIED;
                ll_file_clear_flag(lli, LLIF_DATA_MODIFIED);
        }
@@ -1704,6 +1706,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
        }
 
        op_data->op_attr = *attr;
+       op_data->op_xvalid = xvalid;
 
        rc = ll_md_setattr(dentry, op_data);
        if (rc)
@@ -1712,17 +1715,17 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
        if (!S_ISREG(inode->i_mode) || hsm_import)
                GOTO(out, rc = 0);
 
-       if (attr->ia_valid & (ATTR_SIZE |
-                             ATTR_ATIME | ATTR_ATIME_SET |
-                             ATTR_MTIME | ATTR_MTIME_SET |
-                             ATTR_CTIME | ATTR_CTIME_SET)) {
+       if (attr->ia_valid & (ATTR_SIZE | ATTR_ATIME | ATTR_ATIME_SET |
+                             ATTR_MTIME | ATTR_MTIME_SET | ATTR_CTIME) ||
+           xvalid & OP_XVALID_CTIME_SET) {
                /* For truncate and utimes sending attributes to OSTs, setting
                 * mtime/atime to the past will be performed under PW [0:EOF]
                 * extent lock (new_size:EOF for truncate).  It may seem
                 * excessive to send mtime/atime updates to OSTs when not
                 * setting times to past, but it is necessary due to possible
-                * time de-synchronization between MDT inode and OST objects */
-               rc = cl_setattr_ost(lli->lli_clob, attr, 0);
+                * time de-synchronization between MDT inode and OST objects
+                */
+               rc = cl_setattr_ost(lli->lli_clob, attr, xvalid, 0);
        }
 
        /* If the file was restored, it needs to set dirty flag.
@@ -1782,10 +1785,11 @@ out:
 int ll_setattr(struct dentry *de, struct iattr *attr)
 {
        int mode = de->d_inode->i_mode;
+       enum op_xvalid xvalid = 0;
 
        if ((attr->ia_valid & (ATTR_CTIME|ATTR_SIZE|ATTR_MODE)) ==
                              (ATTR_CTIME|ATTR_SIZE|ATTR_MODE))
-               attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE;
+               xvalid |= OP_XVALID_OWNEROVERRIDE;
 
        if (((attr->ia_valid & (ATTR_MODE|ATTR_FORCE|ATTR_SIZE)) ==
                               (ATTR_SIZE|ATTR_MODE)) &&
@@ -1806,11 +1810,7 @@ int ll_setattr(struct dentry *de, struct iattr *attr)
            !(attr->ia_valid & ATTR_KILL_SGID))
                attr->ia_valid |= ATTR_KILL_SGID;
 
-       /* avoid polluted from ATTR_TIMES_SET,
-        * projid is not expected to be set here */
-       attr->ia_valid &= ~MDS_ATTR_PROJID;
-
-       return ll_setattr_raw(de, attr, false);
+       return ll_setattr_raw(de, attr, xvalid, false);
 }
 
 int ll_statfs_internal(struct ll_sb_info *sbi, struct obd_statfs *osfs,
@@ -2179,13 +2179,13 @@ int ll_iocontrol(struct inode *inode, struct file *file,
                if (get_user(flags, (int __user *)arg))
                        RETURN(-EFAULT);
 
-                op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
-                                             LUSTRE_OPC_ANY, NULL);
-                if (IS_ERR(op_data))
-                        RETURN(PTR_ERR(op_data));
+               op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
+                                            LUSTRE_OPC_ANY, NULL);
+               if (IS_ERR(op_data))
+                       RETURN(PTR_ERR(op_data));
 
                op_data->op_attr_flags = flags;
-                op_data->op_attr.ia_valid |= ATTR_ATTR_FLAG;
+               op_data->op_xvalid |= OP_XVALID_FLAGS;
                rc = md_setattr(sbi->ll_md_exp, op_data, NULL, 0, &req);
                 ll_finish_md_op_data(op_data);
                 ptlrpc_req_finished(req);
@@ -2202,8 +2202,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,
                if (attr == NULL)
                        RETURN(-ENOMEM);
 
-               attr->ia_valid = ATTR_ATTR_FLAG;
-               rc = cl_setattr_ost(obj, attr, flags);
+               rc = cl_setattr_ost(obj, attr, OP_XVALID_FLAGS, flags);
 
                OBD_FREE_PTR(attr);
                RETURN(rc);
index 793ec00..0461487 100644 (file)
@@ -628,12 +628,12 @@ static int vvp_io_setattr_lock(const struct lu_env *env,
        __u64 new_size;
        __u32 enqflags = 0;
 
-        if (cl_io_is_trunc(io)) {
-                new_size = io->u.ci_setattr.sa_attr.lvb_size;
-                if (new_size == 0)
-                        enqflags = CEF_DISCARD_DATA;
-        } else {
-               unsigned int valid = io->u.ci_setattr.sa_valid;
+       if (cl_io_is_trunc(io)) {
+               new_size = io->u.ci_setattr.sa_attr.lvb_size;
+               if (new_size == 0)
+                       enqflags = CEF_DISCARD_DATA;
+       } else {
+               unsigned int valid = io->u.ci_setattr.sa_avalid;
 
                if (!(valid & TIMES_SET_FLAGS))
                        return 0;
@@ -682,16 +682,16 @@ static int vvp_io_setattr_time(const struct lu_env *env,
         int result;
         unsigned valid = CAT_CTIME;
 
-        cl_object_attr_lock(obj);
-        attr->cat_ctime = io->u.ci_setattr.sa_attr.lvb_ctime;
-        if (io->u.ci_setattr.sa_valid & ATTR_ATIME_SET) {
-                attr->cat_atime = io->u.ci_setattr.sa_attr.lvb_atime;
-                valid |= CAT_ATIME;
-        }
-        if (io->u.ci_setattr.sa_valid & ATTR_MTIME_SET) {
-                attr->cat_mtime = io->u.ci_setattr.sa_attr.lvb_mtime;
-                valid |= CAT_MTIME;
-        }
+       cl_object_attr_lock(obj);
+       attr->cat_ctime = io->u.ci_setattr.sa_attr.lvb_ctime;
+       if (io->u.ci_setattr.sa_avalid & ATTR_ATIME_SET) {
+               attr->cat_atime = io->u.ci_setattr.sa_attr.lvb_atime;
+               valid |= CAT_ATIME;
+       }
+       if (io->u.ci_setattr.sa_avalid & ATTR_MTIME_SET) {
+               attr->cat_mtime = io->u.ci_setattr.sa_attr.lvb_mtime;
+               valid |= CAT_MTIME;
+       }
        result = cl_object_attr_update(env, obj, attr, valid);
        cl_object_attr_unlock(obj);
 
@@ -713,7 +713,7 @@ static int vvp_io_setattr_start(const struct lu_env *env,
                inode_lock(inode);
        }
 
-       if (io->u.ci_setattr.sa_valid & TIMES_SET_FLAGS)
+       if (io->u.ci_setattr.sa_avalid & TIMES_SET_FLAGS)
                return vvp_io_setattr_time(env, ios);
 
        return 0;
index 63f617c..8767d91 100644 (file)
@@ -2276,8 +2276,9 @@ static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data,
        int                      rc = 0;
        ENTRY;
 
-       CDEBUG(D_INODE, "SETATTR for "DFID", valid 0x%x\n",
-              PFID(&op_data->op_fid1), op_data->op_attr.ia_valid);
+       CDEBUG(D_INODE, "SETATTR for "DFID", valid 0x%x/0x%x\n",
+              PFID(&op_data->op_fid1), op_data->op_attr.ia_valid,
+              op_data->op_xvalid);
 
        op_data->op_flags |= MF_MDC_CANCEL_FID1;
        tgt = lmv_find_target(lmv, &op_data->op_fid1);
index 7ac4590..c29acfc 100644 (file)
@@ -631,7 +631,8 @@ static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio,
                io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr;
                io->u.ci_setattr.sa_attr_flags =
                        parent->u.ci_setattr.sa_attr_flags;
-               io->u.ci_setattr.sa_valid = parent->u.ci_setattr.sa_valid;
+               io->u.ci_setattr.sa_avalid = parent->u.ci_setattr.sa_avalid;
+               io->u.ci_setattr.sa_xvalid = parent->u.ci_setattr.sa_xvalid;
                io->u.ci_setattr.sa_stripe_index = stripe;
                io->u.ci_setattr.sa_parent_fid =
                                        parent->u.ci_setattr.sa_parent_fid;
index 14b0e65..c06749e 100644 (file)
@@ -998,7 +998,8 @@ static int mdc_io_setattr_start(const struct lu_env *env,
        struct obdo *oa = &oio->oi_oa;
        struct osc_async_cbargs *cbargs = &oio->oi_cbarg;
        __u64 size = io->u.ci_setattr.sa_attr.lvb_size;
-       unsigned int ia_valid = io->u.ci_setattr.sa_valid;
+       unsigned int ia_avalid = io->u.ci_setattr.sa_avalid;
+       enum op_xvalid ia_xvalid = io->u.ci_setattr.sa_xvalid;
        int rc;
 
        /* silently ignore non-truncate setattr for Data-on-MDT object */
@@ -1017,19 +1018,20 @@ static int mdc_io_setattr_start(const struct lu_env *env,
                        struct ost_lvb *lvb = &io->u.ci_setattr.sa_attr;
                        unsigned int cl_valid = 0;
 
-                       if (ia_valid & ATTR_SIZE) {
-                               attr->cat_size = attr->cat_kms = size;
+                       if (ia_avalid & ATTR_SIZE) {
+                               attr->cat_size = size;
+                               attr->cat_kms = size;
                                cl_valid = (CAT_SIZE | CAT_KMS);
                        }
-                       if (ia_valid & ATTR_MTIME_SET) {
+                       if (ia_avalid & ATTR_MTIME_SET) {
                                attr->cat_mtime = lvb->lvb_mtime;
                                cl_valid |= CAT_MTIME;
                        }
-                       if (ia_valid & ATTR_ATIME_SET) {
+                       if (ia_avalid & ATTR_ATIME_SET) {
                                attr->cat_atime = lvb->lvb_atime;
                                cl_valid |= CAT_ATIME;
                        }
-                       if (ia_valid & ATTR_CTIME_SET) {
+                       if (ia_xvalid & OP_XVALID_CTIME_SET) {
                                attr->cat_ctime = lvb->lvb_ctime;
                                cl_valid |= CAT_CTIME;
                        }
@@ -1040,7 +1042,7 @@ static int mdc_io_setattr_start(const struct lu_env *env,
                        return rc;
        }
 
-       if (!(ia_valid & ATTR_SIZE))
+       if (!(ia_avalid & ATTR_SIZE))
                return 0;
 
        memset(oa, 0, sizeof(*oa));
index 2429c1e..9380d74 100644 (file)
@@ -286,8 +286,9 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
        set_mrc_cr_flags(rec, cr_flags);
 }
 
-static inline __u64 attr_pack(unsigned int ia_valid) {
-        __u64 sa_valid = 0;
+static inline u64 attr_pack(unsigned int ia_valid, enum op_xvalid ia_xvalid)
+{
+       u64 sa_valid = 0;
 
         if (ia_valid & ATTR_MODE)
                 sa_valid |= MDS_ATTR_MODE;
@@ -309,26 +310,26 @@ static inline __u64 attr_pack(unsigned int ia_valid) {
                 sa_valid |= MDS_ATTR_MTIME_SET;
         if (ia_valid & ATTR_FORCE)
                 sa_valid |= MDS_ATTR_FORCE;
-        if (ia_valid & ATTR_ATTR_FLAG)
-                sa_valid |= MDS_ATTR_ATTR_FLAG;
-        if (ia_valid & ATTR_KILL_SUID)
-                sa_valid |=  MDS_ATTR_KILL_SUID;
-        if (ia_valid & ATTR_KILL_SGID)
-                sa_valid |= MDS_ATTR_KILL_SGID;
-        if (ia_valid & ATTR_CTIME_SET)
-                sa_valid |= MDS_ATTR_CTIME_SET;
-        if (ia_valid & ATTR_FROM_OPEN)
-                sa_valid |= MDS_ATTR_FROM_OPEN;
-        if (ia_valid & ATTR_BLOCKS)
-                sa_valid |= MDS_ATTR_BLOCKS;
-        if (ia_valid & MDS_OPEN_OWNEROVERRIDE)
-                /* NFSD hack (see bug 5781) */
-                sa_valid |= MDS_OPEN_OWNEROVERRIDE;
-       if (ia_valid & MDS_ATTR_PROJID)
+       if (ia_xvalid & OP_XVALID_FLAGS)
+               sa_valid |= MDS_ATTR_ATTR_FLAG;
+       if (ia_valid & ATTR_KILL_SUID)
+               sa_valid |=  MDS_ATTR_KILL_SUID;
+       if (ia_valid & ATTR_KILL_SGID)
+               sa_valid |= MDS_ATTR_KILL_SGID;
+       if (ia_xvalid & OP_XVALID_CTIME_SET)
+               sa_valid |= MDS_ATTR_CTIME_SET;
+       if (ia_valid & ATTR_FROM_OPEN)
+               sa_valid |= MDS_ATTR_FROM_OPEN;
+       if (ia_xvalid & OP_XVALID_BLOCKS)
+               sa_valid |= MDS_ATTR_BLOCKS;
+       if (ia_xvalid & OP_XVALID_OWNEROVERRIDE)
+               /* NFSD hack (see bug 5781) */
+               sa_valid |= MDS_OPEN_OWNEROVERRIDE;
+       if (ia_xvalid & OP_XVALID_PROJID)
                sa_valid |= MDS_ATTR_PROJID;
-       if (ia_valid & MDS_ATTR_LSIZE)
+       if (ia_xvalid & OP_XVALID_LAZYSIZE)
                sa_valid |= MDS_ATTR_LSIZE;
-       if (ia_valid & MDS_ATTR_LBLOCKS)
+       if (ia_xvalid & OP_XVALID_LAZYBLOCKS)
                sa_valid |= MDS_ATTR_LBLOCKS;
         return sa_valid;
 }
@@ -343,7 +344,8 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec,
        rec->sa_suppgid = -1;
 
        rec->sa_fid    = op_data->op_fid1;
-       rec->sa_valid  = attr_pack(op_data->op_attr.ia_valid);
+       rec->sa_valid  = attr_pack(op_data->op_attr.ia_valid,
+                                  op_data->op_xvalid);
        rec->sa_mode   = op_data->op_attr.ia_mode;
        rec->sa_uid    = from_kuid(&init_user_ns, op_data->op_attr.ia_uid);
        rec->sa_gid    = from_kgid(&init_user_ns, op_data->op_attr.ia_gid);
index b97750f..4fc147a 100644 (file)
@@ -489,10 +489,11 @@ static int osc_io_setattr_start(const struct lu_env *env,
         struct obdo             *oa     = &oio->oi_oa;
        struct osc_async_cbargs *cbargs = &oio->oi_cbarg;
        __u64                    size   = io->u.ci_setattr.sa_attr.lvb_size;
-       unsigned int             ia_valid = io->u.ci_setattr.sa_valid;
-       int                      result = 0;
-       ENTRY;
+       unsigned int ia_avalid = io->u.ci_setattr.sa_avalid;
+       enum op_xvalid ia_xvalid = io->u.ci_setattr.sa_xvalid;
+       int result = 0;
 
+       ENTRY;
        /* truncate cache dirty pages first */
        if (cl_io_is_trunc(io))
                result = osc_cache_truncate_start(env, cl2osc(obj), size,
@@ -505,19 +506,20 @@ static int osc_io_setattr_start(const struct lu_env *env,
                        struct ost_lvb *lvb = &io->u.ci_setattr.sa_attr;
                        unsigned int cl_valid = 0;
 
-                       if (ia_valid & ATTR_SIZE) {
-                               attr->cat_size = attr->cat_kms = size;
+                       if (ia_avalid & ATTR_SIZE) {
+                               attr->cat_size = size;
+                               attr->cat_kms = size;
                                cl_valid = (CAT_SIZE | CAT_KMS);
                        }
-                       if (ia_valid & ATTR_MTIME_SET) {
+                       if (ia_avalid & ATTR_MTIME_SET) {
                                attr->cat_mtime = lvb->lvb_mtime;
                                cl_valid |= CAT_MTIME;
                        }
-                       if (ia_valid & ATTR_ATIME_SET) {
+                       if (ia_avalid & ATTR_ATIME_SET) {
                                attr->cat_atime = lvb->lvb_atime;
                                cl_valid |= CAT_ATIME;
                        }
-                       if (ia_valid & ATTR_CTIME_SET) {
+                       if (ia_xvalid & OP_XVALID_CTIME_SET) {
                                attr->cat_ctime = lvb->lvb_ctime;
                                cl_valid |= CAT_CTIME;
                        }
@@ -534,45 +536,45 @@ static int osc_io_setattr_start(const struct lu_env *env,
                oa->o_layout = io->u.ci_setattr.sa_layout;
                oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP |
                        OBD_MD_FLOSTLAYOUT;
-               if (ia_valid & ATTR_CTIME) {
+               if (ia_avalid & ATTR_CTIME) {
                        oa->o_valid |= OBD_MD_FLCTIME;
                        oa->o_ctime = attr->cat_ctime;
                }
-               if (ia_valid & ATTR_ATIME) {
+               if (ia_avalid & ATTR_ATIME) {
                        oa->o_valid |= OBD_MD_FLATIME;
                        oa->o_atime = attr->cat_atime;
                }
-               if (ia_valid & ATTR_MTIME) {
+               if (ia_avalid & ATTR_MTIME) {
                        oa->o_valid |= OBD_MD_FLMTIME;
                        oa->o_mtime = attr->cat_mtime;
                }
-                if (ia_valid & ATTR_SIZE) {
-                        oa->o_size = size;
-                        oa->o_blocks = OBD_OBJECT_EOF;
-                        oa->o_valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
-
-                        if (oio->oi_lockless) {
-                                oa->o_flags = OBD_FL_SRVLOCK;
-                                oa->o_valid |= OBD_MD_FLFLAGS;
-                        }
+               if (ia_avalid & ATTR_SIZE) {
+                       oa->o_size = size;
+                       oa->o_blocks = OBD_OBJECT_EOF;
+                       oa->o_valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
+
+                       if (oio->oi_lockless) {
+                               oa->o_flags = OBD_FL_SRVLOCK;
+                               oa->o_valid |= OBD_MD_FLFLAGS;
+                       }
 
                        if (io->ci_layout_version > 0) {
                                /* verify layout version */
                                oa->o_valid |= OBD_MD_LAYOUT_VERSION;
                                oa->o_layout_version = io->ci_layout_version;
                        }
-                } else {
-                        LASSERT(oio->oi_lockless == 0);
-                }
+               } else {
+                       LASSERT(oio->oi_lockless == 0);
+               }
 
-               if (ia_valid & ATTR_ATTR_FLAG) {
+               if (ia_xvalid & OP_XVALID_FLAGS) {
                        oa->o_flags = io->u.ci_setattr.sa_attr_flags;
                        oa->o_valid |= OBD_MD_FLFLAGS;
                }
 
                init_completion(&cbargs->opc_sync);
 
-               if (ia_valid & ATTR_SIZE)
+               if (ia_avalid & ATTR_SIZE)
                        result = osc_punch_send(osc_export(cl2osc(obj)),
                                                oa, osc_async_upcall, cbargs);
                else