Whamcloud - gitweb
LU-6413 lod: set FLAGS all stripes of striped dir 78/14278/2
authorwang di <di.wang@intel.com>
Mon, 30 Mar 2015 00:35:47 +0000 (17:35 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 10 Apr 2015 04:29:57 +0000 (04:29 +0000)
Except permission and time, flags should be set on
each stripe of striped dir as well, otherwise
chattr can not set special flags (immutable etc)
correctly on striped dir.

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: I8b3274b674bd1b8b41f95bb9299245aa8c2905c3
Reviewed-on: http://review.whamcloud.com/14278
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_object.c
lustre/tests/sanity.sh

index f8d3a00..2ba89c2 100644 (file)
@@ -1176,7 +1176,8 @@ static int lod_declare_attr_set(const struct lu_env *env,
                        RETURN(0);
        } else {
                if (!(attr->la_valid & (LA_UID | LA_GID | LA_MODE |
                        RETURN(0);
        } else {
                if (!(attr->la_valid & (LA_UID | LA_GID | LA_MODE |
-                                       LA_ATIME | LA_MTIME | LA_CTIME)))
+                                       LA_ATIME | LA_MTIME | LA_CTIME |
+                                       LA_FLAGS)))
                        RETURN(rc);
        }
        /*
                        RETURN(rc);
        }
        /*
@@ -1267,7 +1268,8 @@ static int lod_attr_set(const struct lu_env *env,
                        RETURN(0);
        } else {
                if (!(attr->la_valid & (LA_UID | LA_GID | LA_MODE |
                        RETURN(0);
        } else {
                if (!(attr->la_valid & (LA_UID | LA_GID | LA_MODE |
-                                       LA_ATIME | LA_MTIME | LA_CTIME)))
+                                       LA_ATIME | LA_MTIME | LA_CTIME |
+                                       LA_FLAGS)))
                        RETURN(rc);
        }
 
                        RETURN(rc);
        }
 
index 5d4cc9f..2ec1cee 100644 (file)
@@ -12963,6 +12963,11 @@ test_striped_dir() {
        [ $(stat -c%h $DIR/$tdir/striped_dir) == '2' ] ||
                error "nlink error after rmdir"
 
        [ $(stat -c%h $DIR/$tdir/striped_dir) == '2' ] ||
                error "nlink error after rmdir"
 
+       chattr +i $DIR/$tdir/striped_dir
+       createmany -o $DIR/$tdir/striped_dir/f 10 &&
+               error "immutable flags not working under striped dir!"
+       chattr -i $DIR/$tdir/striped_dir
+
        rmdir $DIR/$tdir/striped_dir ||
                error "rmdir striped dir error"
 
        rmdir $DIR/$tdir/striped_dir ||
                error "rmdir striped dir error"