Whamcloud - gitweb
LU-3744 llite: use 64bits flags in ll_lov_setea() 12/7312/2
authorNiu Yawei <yawei.niu@intel.com>
Tue, 13 Aug 2013 02:59:13 +0000 (22:59 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 14 Aug 2013 18:26:55 +0000 (18:26 +0000)
In ll_lov_setea(), setting MDS_OPEN_HAS_OBJS to an int flags will
result in the flags being overflowed.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I7c623785579d782dd7ce03e0ca291d32ad3952f9
Reviewed-on: http://review.whamcloud.com/7312
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/xattr.c

index 8c06a27..a82ff30 100644 (file)
@@ -1432,7 +1432,8 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
 }
 
 int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
-                             int flags, struct lov_user_md *lum, int lum_size)
+                             __u64  flags, struct lov_user_md *lum,
+                            int lum_size)
 {
        struct lov_stripe_md *lsm = NULL;
        struct lookup_intent oit = {.it_op = IT_OPEN, .it_flags = flags};
@@ -1554,7 +1555,7 @@ out:
 static int ll_lov_setea(struct inode *inode, struct file *file,
                             unsigned long arg)
 {
-       int                      flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE;
+       __u64                    flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE;
        struct lov_user_md      *lump;
        int                      lum_size = sizeof(struct lov_user_md) +
                                            sizeof(struct lov_user_ost_data);
@@ -1587,7 +1588,7 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file,
        struct lov_user_md_v1   *lumv1p = (struct lov_user_md_v1 *)arg;
        struct lov_user_md_v3   *lumv3p = (struct lov_user_md_v3 *)arg;
        int                      lum_size, rc;
-       int                      flags = FMODE_WRITE;
+       __u64                    flags = FMODE_WRITE;
        ENTRY;
 
        /* first try with v1 which is smaller than v3 */
index 4322c35..c55a63a 100644 (file)
@@ -821,8 +821,8 @@ int ll_inode_permission(struct inode *inode, int mask);
 #endif
 
 int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
-                             int flags, struct lov_user_md *lum,
-                             int lum_size);
+                            __u64  flags, struct lov_user_md *lum,
+                            int lum_size);
 int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
                              struct lov_mds_md **lmm, int *lmm_size,
                              struct ptlrpc_request **request);
index 093f60d..1b5b821 100644 (file)
@@ -241,17 +241,17 @@ int ll_setxattr(struct dentry *dentry, const char *name,
                 if (lump != NULL && lump->lmm_stripe_offset == 0)
                         lump->lmm_stripe_offset = -1;
 
-                if (lump != NULL && S_ISREG(inode->i_mode)) {
-                        struct file f;
-                        int flags = FMODE_WRITE;
+               if (lump != NULL && S_ISREG(inode->i_mode)) {
+                       struct file     f;
+                       __u64           it_flags = FMODE_WRITE;
                        int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ?
                                sizeof(*lump) : sizeof(struct lov_user_md_v3);
 
                        f.f_dentry = dentry;
-                       rc = ll_lov_setstripe_ea_info(inode, &f, flags, lump,
+                       rc = ll_lov_setstripe_ea_info(inode, &f, it_flags, lump,
                                                      lum_size);
-                        /* b10667: rc always be 0 here for now */
-                        rc = 0;
+                       /* b10667: rc always be 0 here for now */
+                       rc = 0;
                 } else if (S_ISDIR(inode->i_mode)) {
                         rc = ll_dir_setstripe(inode, lump, 0);
                 }