Subject: Re: [vserver] testfs.sh-0.20 patches
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Thu, 20 Aug 2009 15:18:51 +0200

On Wed, Aug 19, 2009 at 01:48:33PM -0500, Corey Wright wrote:
> attached are two patches to testfs.sh-0.20 based on an irc conversation
> (http://irc.13thfloor.at/LOG/2009-08/LOG_2009-08-19.txt) and experience
> with a stable kernel (2.6.27.31), a recent/stable linux-vserver patch
> (vs2.3.0.36.6), and several util-vserver versions (0.30.216-pre2841,
> 0.30.216-pre2772, & 0.30.214; in case that makes a difference) on two
> different platforms (debian lenny amd64 & ubuntu hardy i386).
> 
> detailed explanations are at the top of each patch file.
> 
> corey
> -- 
> undefined@pobox.com

> change pattern passed to do_xattr_barrier (.^^ -> ..^) as context 1 has access
> to the barrier (where it did not previously)
> 
> --- /root/bin/testfs.sh-0.20	2008-09-04 08:50:31.000000000 -0500
> +++ /root/bin/testfs.sh-0.20a	2009-08-19 10:02:33.000000000 -0500
> @@ -495,7 +495,7 @@ function do_test () {
>  	eexec 103	0 "do_xattr_verify $MNT showattr $dpath $attr_B"
>  	eexec 104	0 "do_xattr_verify $MNT lsattr $dpath $lsattr_B"
>  	eexec 105	0 "go_xid 2 chattr =i $dpath"
> -	eexec 106	0 "do_xattr_barrier $MNT $dpath .^^"
> +	eexec 106	0 "do_xattr_barrier $MNT $dpath ..^"
>  	eexec 108	0 "setattr --~barrier $dpath"
>  	eexec 109	0 "do_xattr_verify $MNT showattr $dpath $attr_b"
>  	eeval		  "rmdir $dpath"

this should be fine ...

> change expected result to fail (0 -> 1) as trying to execute chattr on a
> barrier from context 2 is expected to fail.
> 
> this test is problematic because some versions of chattr (e2fsprogs
> 1.40.8-2ubuntu2 in ubuntu hardy) return success even though the barrier is not
> visible to chattr (ie "chattr: No such file or directory while trying to stat
> <barrier>").  so even though chattr failed to act on the barrier (as it could
> not see it), it still reports success (ie exit code 0).
> 
> todo/suggestion: first stat the barrier and only try to chattr the barrier if
> stat is successful (because if stat fails, then chattr will definitely fail).

should probably be the other way round, i.e.
chattr && stat 
so that the chattr is executed in any case, and
the effect on the directory can be checked in
a second step ...

> --- /root/bin/testfs.sh-0.20a	2009-08-19 10:02:33.000000000 -0500
> +++ /root/bin/testfs.sh-0.20b	2009-08-19 12:04:09.000000000 -0500
> @@ -494,7 +494,7 @@ function do_test () {
>  	eexec 102	0 "setattr --barrier $dpath"
>  	eexec 103	0 "do_xattr_verify $MNT showattr $dpath $attr_B"
>  	eexec 104	0 "do_xattr_verify $MNT lsattr $dpath $lsattr_B"
> -	eexec 105	0 "go_xid 2 chattr =i $dpath"
> +	eexec 105	1 "go_xid 2 chattr =i $dpath"
>  	eexec 106	0 "do_xattr_barrier $MNT $dpath ..^"
>  	eexec 108	0 "setattr --~barrier $dpath"
>  	eexec 109	0 "do_xattr_verify $MNT showattr $dpath $attr_b"

probably correct, will investigate 

thanks,
Herbert