6 # This test needs to be run on the client
9 LUSTRE=${LUSTRE:-`dirname $0`/..}
10 . $LUSTRE/tests/test-framework.sh
14 . ${CONFIG:=$LUSTRE/tests/cfg/lmv.sh}
20 SETUP=${SETUP:-"setup"}
21 CLEANUP=${CLEANUP:-"cleanup"}
25 CRYPT_TYPE=${CRYPT_TYPE:-"gks"}
26 RUN_UID=${RUN_UID:-1000}
27 if [ `using_krb5_sec $SECURITY` == 'n' ] ; then
28 ALWAYS_EXCEPT="0c $ALWAYS_EXCEPT"
34 if [ "$MDSCOUNT" -gt 1 ]; then
36 for mds in `mds_list`; do
37 MDSDEV=$TMP/${mds}-`hostname`
38 add_mds $mds --dev $MDSDEV --size $MDSSIZE --lmv lmv1_svc
40 add_lov_to_lmv lov1 lmv1_svc --stripe_sz $STRIPE_BYTES \
41 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
44 add_mds $SINGLEMDS --dev $MDSDEV --size $MDSSIZE
45 if [ ! -z "$$SINGLEMDSfailover_HOST" ]; then
46 add_mdsfailover $SINGLEMDS --dev $MDSDEV --size $MDSSIZE
48 add_lov lov1 $SINGLEMDS --stripe_sz $STRIPE_BYTES \
49 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
52 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
53 add_ost ost2 --lov lov1 --dev ${OSTDEV}-2 --size $OSTSIZE
54 if [ $CRYPT_TYPE == "gks" ]; then
56 add_client client $MDS --lov lov1 --gks gks_svc --path $MOUNT
58 add_client client $MDS --lov lov1 --path $MOUNT
66 # make sure we are using the primary MDS, so the config log will
67 # be able to clean up properly.
68 activemds=`facet_active $SINGLEMDS`
69 if [ $activemds != "$SINGLEMDS" ]; then
73 umount $MOUNT2 || true
76 if [ $CRYPT_TYPE == "gks" ]; then
79 for mds in `mds_list`; do
80 stop $mds ${FORCE} $MDSLCONFARGS
82 stop ost2 ${FORCE} --dump cleanup.log
83 stop ost ${FORCE} --dump cleanup.log
88 if [ "$ONLY" == "cleanup" ]; then
89 sysctl -w portals.debug=0 || true
98 start_krb5_kdc || exit 1
99 start_lsvcgssd || exit 2
100 start_lgssd || exit 3
101 start ost --reformat $OSTLCONFARGS
102 start ost2 --reformat $OSTLCONFARGS
103 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
104 for mds in `mds_list`; do
105 start $mds --reformat $MDSLCONFARGS
107 if [ $CRYPT_TYPE == "gks" ]; then
108 start_gks gks || exit 4
110 grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT
111 grep " $MOUNT2 " /proc/mounts || zconf_mount `hostname` $MOUNT2
116 if [ "$ONLY" == "setup" ]; then
121 grep " $MOUNT " /proc/mounts && umount $MOUNT
122 zconf_mount `hostname` $NAME
126 grep " $MOUNT " /proc/mounts && umount $MOUNT
127 zconf_mount `hostname` $MOUNT
128 $LCTL set_crypt $MOUNT $CRYPT_TYPE
134 enable_encrypt $MOUNT
135 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/1a0
136 echo aaaaaaaaaaaaaaaaaaaa >> $DIR2/1a1
137 diff -u $DIR1/1a0 $DIR2/1a1 || error "files are different"
138 disable_encrypt $MOUNT
139 diff -u $DIR1/1a0 $DIR2/1a1 && error "write encryption failed"
140 enable_encrypt $MOUNT
141 diff -u $DIR1/1a0 $DIR2/1a1 || error "files are different"
143 run_test 1a "read/write encryption============="
146 enable_encrypt $MOUNT
148 setfacl -m u:bin:rw $DIR1/2a0
149 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/2a0
150 echo aaaaaaaaaaaaaaaaaaaa >> $DIR2/2a1
151 diff -u $DIR1/2a0 $DIR2/2a1 || error "files are different"
152 disable_encrypt $MOUNT
153 diff -u $DIR1/2a0 $DIR2/2a1 && error "write encryption failed"
154 enable_encrypt $MOUNT
155 diff -u $DIR1/2a0 $DIR2/2a1 || error "files are different"
157 run_test 2a "read/write encryption with acl============="
161 enable_encrypt $MOUNT
162 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/3a0
163 echo aaaaaaaaaaaaaaaaaaaa >> $DIR2/3a1
164 chown $RUN_UID $DIR1/3a0
165 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/3a0 || error "chown write error"
166 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/3a1
167 diff -u $DIR1/3a0 $DIR2/3a1 || error "files are different"
168 disable_encrypt $MOUNT
169 diff -u $DIR1/3a0 $DIR2/3a1 && error "write encryption failed"
170 enable_encrypt $MOUNT
171 diff -u $DIR1/3a0 $DIR2/3a1 || error "files are different"
173 run_test 3a "write chown encryption============="
177 enable_encrypt $MOUNT
178 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/4a0
179 echo aaaaaaaaaaaaaaaaaaaa >> $DIR2/4a1
180 setfacl -m u:bin:rw $DIR1/4a0
181 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/4a0 || error "chown write error"
182 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/4a1
183 diff -u $DIR1/4a0 $DIR2/4a1 || error "files are different"
184 disable_encrypt $MOUNT
185 diff -u $DIR1/4a0 $DIR2/4a1 && error "write encryption failed"
186 enable_encrypt $MOUNT
187 diff -u $DIR1/4a0 $DIR2/4a1 || error "files are different"
189 run_test 4a "write chacl encryption============="
193 enable_encrypt $MOUNT
194 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/5a0
195 echo aaaaaaaaaaaaaaaaaaaa >> $DIR2/5a1
196 setfacl -m u:bin:rw $DIR1/5a0
197 chown $RUN_UID $DIR1/5a0
198 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/5a0 || error "chown write error"
199 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/5a1
200 diff -u $DIR1/5a0 $DIR2/5a1 || error "files are different"
201 echo "enable crypt read success"
202 disable_encrypt $MOUNT
203 diff -u $DIR1/5a0 $DIR2/5a1 && error "write encryption failed"
204 enable_encrypt $MOUNT
205 diff -u $DIR1/5a0 $DIR2/5a1 || error "files are different"
207 run_test 5a "write chacl encryption============="
211 enable_encrypt $MOUNT
212 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/6a0
213 echo aaaaaaaaaaaaaaaaaaaa >> $DIR2/6a1
215 setfacl -m u:bin:rw $DIR1/6a0
216 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/6a0 || error "chown write error"
217 echo aaaaaaaaaaaaaaaaaaaa >> $DIR1/6a1
218 diff -u $DIR1/6a0 $DIR2/6a1 || error "files are different"
219 echo "enable crypt read success"
220 disable_encrypt $MOUNT
221 diff -u $DIR1/6a0 $DIR2/6a1 && error "write encryption failed"
222 enable_encrypt $MOUNT
223 diff -u $DIR1/6a0 $DIR2/6a1 || error "files are different"
225 run_test 6a "write chmod/setfacl encryption============="