Whamcloud - gitweb
b=22376 accmode fix
authorVitaly Fertman <vitaly.fertman@oracle.com>
Thu, 16 Dec 2010 00:19:36 +0000 (03:19 +0300)
committerVitaly Fertman <vitaly.fertman@oracle.com>
Fri, 17 Dec 2010 01:21:41 +0000 (04:21 +0300)
i=tappro
i=green

accmode is fixed to not let other flags to be set together with MAY_EXEC
test is added

lustre/mdd/mdd_object.c
lustre/tests/sanity.sh

index 95420dc..82fe0a3 100644 (file)
@@ -1961,7 +1961,7 @@ int accmode(const struct lu_env *env, struct lu_attr *la, int flags)
         if (flags & (FMODE_WRITE | MDS_OPEN_TRUNC | MDS_OPEN_APPEND))
                 res |= MAY_WRITE;
         if (flags & MDS_FMODE_EXEC)
-                res |= MAY_EXEC;
+                res = MAY_EXEC;
         return res;
 }
 
index 90b3d71..4074a4f 100644 (file)
@@ -1444,12 +1444,30 @@ test_29() {
 }
 run_test 29 "IT_GETATTR regression  ============================"
 
-test_30() {
+test_30a() { # was test_30
        cp `which ls` $DIR || cp /bin/ls $DIR
-       $DIR/ls /
+       $DIR/ls / || error
        rm $DIR/ls
 }
-run_test 30 "run binary from Lustre (execve) ==================="
+run_test 30a "execute binary from Lustre (execve) =============="
+
+test_30b() {
+       cp `which ls` $DIR || cp /bin/ls $DIR
+       chmod go+rx $DIR/ls
+       $RUNAS $DIR/ls / || error
+       rm $DIR/ls
+}
+run_test 30b "execute binary from Lustre as non-root ==========="
+
+test_30c() { # b=22376
+       cp `which ls` $DIR || cp /bin/ls $DIR
+       chmod a-rw $DIR/ls
+       cancel_lru_locks mdc
+       cancel_lru_locks osc
+       $RUNAS $DIR/ls / || error
+       rm -f $DIR/ls
+}
+run_test 30c "execute binary from Lustre without read perms ===="
 
 test_31a() {
        $OPENUNLINK $DIR/f31 $DIR/f31 || error