+test_57() {
+ local testdir=$DIR/$tdir/mytestdir
+ local testfile=$DIR/$tdir/$tfile
+
+ [[ $(facet_fstype ost1) == zfs ]] && skip "skip ZFS backend"
+
+ $LCTL get_param mdc.*.import | grep -q client_encryption ||
+ skip "client encryption not supported"
+
+ mount.lustre --help |& grep -q "test_dummy_encryption:" ||
+ skip "need dummy encryption support"
+
+ mkdir $DIR/$tdir
+ mkdir $testdir
+ setfattr -n security.c -v myval $testdir &&
+ error "setting xattr on $testdir should have failed (1)"
+ touch $testfile
+ setfattr -n security.c -v myval $testfile &&
+ error "setting xattr on $testfile should have failed (1)"
+
+ rm -rf $DIR/$tdir
+
+ stack_trap cleanup_for_enc_tests EXIT
+ setup_for_enc_tests
+
+ mkdir $testdir
+ if [ $(getfattr -n security.c $testdir 2>&1 |
+ grep -ci "Operation not permitted") -eq 0 ]; then
+ error "getting xattr on $testdir should have failed"
+ fi
+ getfattr -d -m - $testdir 2>&1 | grep security\.c &&
+ error "listing xattrs on $testdir should not expose security.c"
+ if [ $(setfattr -n security.c -v myval $testdir 2>&1 |
+ grep -ci "Operation not permitted") -eq 0 ]; then
+ error "setting xattr on $testdir should have failed (2)"
+ fi
+ touch $testfile
+ if [ $(getfattr -n security.c $testfile 2>&1 |
+ grep -ci "Operation not permitted") -eq 0 ]; then
+ error "getting xattr on $testfile should have failed"
+ fi
+ getfattr -d -m - $testfile 2>&1 | grep security\.c &&
+ error "listing xattrs on $testfile should not expose security.c"
+ if [ $(setfattr -n security.c -v myval $testfile 2>&1 |
+ grep -ci "Operation not permitted") -eq 0 ]; then
+ error "setting xattr on $testfile should have failed (2)"
+ fi
+ return 0
+}
+run_test 57 "security.c xattr protection"
+
+test_58() {
+ local testdir=$DIR/$tdir/mytestdir
+ local testfile=$DIR/$tdir/$tfile
+
+ [[ $(facet_fstype ost1) == zfs ]] && skip "skip ZFS backend"
+
+ $LCTL get_param mdc.*.import | grep -q client_encryption ||
+ skip "client encryption not supported"
+
+ mount.lustre --help |& grep -q "test_dummy_encryption:" ||
+ skip "need dummy encryption support"
+
+ stack_trap cleanup_for_enc_tests EXIT
+ setup_for_enc_tests
+
+ touch $DIR/$tdir/$tfile
+ mkdir $DIR/$tdir/subdir
+
+ cancel_lru_locks
+ sync ; sync
+ echo 3 > /proc/sys/vm/drop_caches
+
+ ll_decode_linkea $DIR/$tdir/$tfile || error "cannot read $tfile linkea"
+ ll_decode_linkea $DIR/$tdir/subdir || error "cannot read subdir linkea"
+
+ for ((i = 0; i < 1000; i = $((i+1)))); do
+ mkdir -p $DIR/$tdir/d${i}
+ touch $DIR/$tdir/f${i}
+ createmany -m $DIR/$tdir/d${i}/f 5 > /dev/null
+ done
+
+ cancel_lru_locks
+ sync ; sync
+ echo 3 > /proc/sys/vm/drop_caches
+
+ sleep 10
+ ls -ailR $DIR/$tdir > /dev/null || error "fail to ls"
+}
+run_test 58 "access to enc file's xattrs"
+