Skip to contentSkip to conversation

xfstests 062: fix support for ext4 and SELinux

PATCH In review [email protected] 5 participants 15 messages Apr 13, 2012 – Apr 16, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 xfstests 062: fix support for ext4 and SELinux

From: Tom Marek <[email protected]>

Tests number 062 was supposed to work with ext4 fs but there were some problems in it - Tests haven't considered existence of lost+found directory in ext4. Also when scratch was mounted with SELinux context test failed because fgetattr returns SELinux extended attributes. And when fgetattr is run with recursive flag it's output might change between file systems due to different file ordering. Fix this by sorting the output manually. Also all lines containing SELinux and lost+found were removed from output.

---
 062     |   50 ++++++++++++++++++++++++++---------
 062.out |   90 +++++++++++++++++++++++++++++++-------------------------------
 2 files changed, 82 insertions(+), 58 deletions(-)
062 +37 -13
index f666e1b..116296b 100755
@@ -46,6 +46,30 @@ _cleanup()
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
+# remove "security.selinux=..." because it is not installed on all systems
+# and it not relevant to this test
+_remove_selinux(){
+	egrep -v '^(selinux|security\.selinux)'
+}
+
+# sort getfattr output and remove entries containing only selinux attributes
+_sort_getfattr(){
+	awk '
+	BEGIN{
+		RS=""
+	}
+	{
+		a[FNR]=$0
+	}
+	END{
+		n = asort(a);
+		for(i = 1; i <= n; ++i){
+			if (a[i] ~ /# file: SCRATCH_MNT[^\n]*\nsecurity.selinux[^\n]*\n/)
+				print a[i] "\n"
+		}
+	}'
+}
+
 getfattr()
 {
     $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch
@@ -67,7 +91,7 @@ _create_test_bed()
 	mknod $SCRATCH_MNT/dev/c c 0 0
 	mknod $SCRATCH_MNT/dev/p p
 	# sanity check
-	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 # real QA test starts here
@@ -102,7 +126,7 @@ for nsp in $ATTR_MODES; do
 		echo "*** set/get one initially empty attribute"
     
 		setfattr -h -n $nsp.name $SCRATCH_MNT/$inode
-		getfattr -m $nsp $SCRATCH_MNT/$inode
+		getfattr -m $nsp $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** overwrite empty, set several new attributes"
 		setfattr -h -n $nsp.name -v 0xbabe $SCRATCH_MNT/$inode
@@ -110,33 +134,33 @@ for nsp in $ATTR_MODES; do
 		setfattr -h -n $nsp.name3 -v 0xdeface $SCRATCH_MNT/$inode
 
 		echo "*** fetch several attribute names and values (hex)"
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** fetch several attribute names and values (base64)"
-		getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode | _remove_selinux
 		
 		echo "*** shrink value of an existing attribute"
 		setfattr -h -n $nsp.name2 -v 0xdeaf $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** grow value of existing attribute"
 		setfattr -h -n $nsp.name2 -v 0xdecade $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 		
 		echo "*** set an empty value for second attribute"
 		setfattr -h -n $nsp.name2 $SCRATCH_MNT/$inode
-		getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** overwrite empty value"
 		setfattr -h -n $nsp.name2 -v 0xcafe $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** remove attribute"
 		setfattr -h -x $nsp.name2 $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** final list (strings, type=$inode, nsp=$nsp)"
-		getfattr -m '.' -e hex $SCRATCH_MNT/$inode
+		getfattr -m '.' -e hex $SCRATCH_MNT/$inode | _sort_getfattr | _remove_selinux
 	
 	done
 done
@@ -160,18 +184,18 @@ _extend_test_bed()
 	# whack a symlink in the middle, just to be difficult
 	ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
 	# dump out our new starting point
-	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 _extend_test_bed
 
 echo
 echo "*** directory descent with us following symlinks"
-getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
 
 echo
 echo "*** directory descent without following symlinks"
-getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
 
 
 # 
062.out +45 -45

129 lines not on this page · raw message

Signature · 6 lines
1.7.7.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw

PATCH 2/5 xfstests 233: fix user fsgqa access to fsstress

From: Tom Marek <[email protected]>

User fsgqa may sometimes be unable to run fsstress (when xfstests are owned by root) because fsgqa doesn't have rights to list directory where the fsstress utility is located.

This fix changes directory to fsstress location as root before running fsstress so user fsgqa may run it without any problems.

---
 233 |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
233 +4 -2
index 28e6ac7..e9eacae 100755
@@ -62,14 +62,16 @@ _fsstress()
 -f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 \
 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 \
 -n $count -d $out -p 7"
-
 	echo "fsstress $args" | tee -a $here/$seq.full | sed -e "s#$out#outdir#"
-	if ! su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $here/$seq.full | _filter_num
+	fsstressdir=${FSSTRESS_PROG%/*}
+	cd $fsstressdir
+	if ! su $qa_user -c "./`basename $FSSTRESS_PROG` $args" | tee -a $here/$seq.full | _filter_num
 	then
 		echo "    fsstress $args returned $?"
 		cat $tmp.out | tee -a $here/$seq.full
 		status=1
 	fi
+	cd $here
 }
 
 # real QA test starts here
Signature · 6 lines
1.7.7.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw

PATCH 3/5 xfstests 198, 240: added check for aiodio-sparse2

In reply to [email protected]

From: Tom Marek <[email protected]>

Tests number 198 and 240 could fail when aiodio-sparse2 was not build. Check whether aiodio-sparse is built was added to both tests.

---
 198 |    2 ++
 240 |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
198 +2 -0
index e46ec8d..b9b47b2 100755
@@ -45,6 +45,8 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 
+[-x $here/src/aio-dio-regress/aiodio_sparse2] || _notrun "src/aio-dio-regress/aiodio_sparse2 not built"
+
 echo "Silence is golden."
 
 # real QA test starts here
240 +2 -0
index 563449e..5a563ca 100755
@@ -53,6 +53,8 @@ _supported_os Linux
 
 _require_sparse_files
 
+[-x $here/src/aio-dio-regress/aiodio_sparse2] || _notrun "src/aio-dio-regress/aiodio_sparse2 not built"
+
 echo "Silence is golden."
 
 # real QA test starts here
Signature · 6 lines
1.7.7.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#3 lore raw

Re: [PATCH 3/5] xfstests 198, 240: added check for aiodio-sparse2

Quoted 18 lines · On Fri, Apr 13, 2012 at 11:49:44AM +0200, [email protected] wrote:

From: Tom Marek <[email protected]>

Tests number 198 and 240 could fail when aiodio-sparse2 was not build. Check whether aiodio-sparse is built was added to both tests.

---
 198 |    2 ++
 240 |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
198 +0 -0
index e46ec8d..b9b47b2 100755

198 _cleanup() · line 49

Quoted 5 lines
198 +2 -0
@@ -45,6 +45,8 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 
+[-x $here/src/aio-dio-regress/aiodio_sparse2] || _notrun "src/aio-dio-regress/aiodio_sparse2 not built"
+

_require_aiodio

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#4 lore raw

PATCH 4/5 xfstests: sync before umount to avoid device busy problems

In reply to [email protected]

From: Tom Marek <[email protected]>

Some tests might fail because of 'device or resource busy' when unmounting either the SCRATCH or the TEST device. The reason this happenes is that some processes might not have time to finish properly, or they are still waiting for IO. The sync command was added before unmount into _scratch_unmount() and umount_or_remount_ro which should help processes to finish before unmounting takes place and thus it solves the problem. This fixes for example tests 226 and 247.

Test 226 uses plain umount command which suffers from exactly the same problem as described above. Use fixed _scratch_unmount() instead of plain umount fixes this problem.

---
 226       |    4 ++--
 common.rc |    5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
226 +2 -2
index 6f28ac9..f8847c6 100755
@@ -61,7 +61,7 @@ for I in `seq 1 $loops`; do
 done
 
 echo
-umount $SCRATCH_DEV
+_scratch_unmount
 _scratch_mount
 
 echo "--> $loops direct 64m writes in a loop"
@@ -73,7 +73,7 @@ for I in `seq 1 $loops`; do
 done
 
 echo
-umount $SCRATCH_DEV
+_scratch_unmount
 
 status=0
 exit
common.rc +5 -0
index cab0b64..e56e5bc 100644
@@ -255,6 +255,8 @@ _scratch_mount()
 
 _scratch_unmount()
 {
+    # Run sync to give processes some time to finish before unmount
+    sync
     $UMOUNT_PROG $SCRATCH_DEV
 }
 
@@ -1051,6 +1053,9 @@ _umount_or_remount_ro()
     device=$1
     mountpoint=`_is_mounted $device`
 
+    # Run sync to give processes some time to finish before unmount
+    sync
+
     if [ $USE_REMOUNT -eq 0 ]; then
         $UMOUNT_PROG $device
     else
Signature · 6 lines
1.7.7.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#5 lore raw

Re: [PATCH 4/5] xfstests: sync before umount to avoid device busy problems

Quoted 58 lines · On 4/13/2012 11:49 AM, [email protected] wrote:

From: Tom Marek <[email protected]>

Some tests might fail because of 'device or resource busy' when unmounting either the SCRATCH or the TEST device. The reason this happenes is that some processes might not have time to finish properly, or they are still waiting for IO. The sync command was added before unmount into _scratch_unmount() and umount_or_remount_ro which should help processes to finish before unmounting takes place and thus it solves the problem. This fixes for example tests 226 and 247.

Test 226 uses plain umount command which suffers from exactly the same problem as described above. Use fixed _scratch_unmount() instead of plain umount fixes this problem.

---
 226       |    4 ++--
 common.rc |    5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
226 +2 -2
index 6f28ac9..f8847c6 100755
@@ -61,7 +61,7 @@ for I in `seq 1 $loops`; do
 done
 
 echo
-umount $SCRATCH_DEV
+_scratch_unmount
 _scratch_mount
 
 echo "--> $loops direct 64m writes in a loop"
@@ -73,7 +73,7 @@ for I in `seq 1 $loops`; do
 done
 
 echo
-umount $SCRATCH_DEV
+_scratch_unmount
 
 status=0
 exit
common.rc +2 -0
index cab0b64..e56e5bc 100644
@@ -255,6 +255,8 @@ _scratch_mount()
 
 _scratch_unmount()
 {
+    # Run sync to give processes some time to finish before unmount
+    sync
     $UMOUNT_PROG $SCRATCH_DEV
 }
 

common.rc _umount_or_remount_ro() · line 1061

Quoted 9 lines
common.rc +3 -0
@@ -1051,6 +1053,9 @@ _umount_or_remount_ro()
     device=$1
     mountpoint=`_is_mounted $device`
 
+    # Run sync to give processes some time to finish before unmount
+    sync
+
     if [ $USE_REMOUNT -eq 0 ]; then
         $UMOUNT_PROG $device
     else

If a xfstest process is still running when _scratch_umount() is called, that xfstest is wrong and needs to be fixed IMO.
If a system or filesystem thread is still running and umount fails to handle it, the system or filesystem needs to be fixed IMO.

xfstests shall uncover issues, not hide them.

sync before umount should never be required.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#6 lore raw

Re: [PATCH 4/5] xfstests: sync before umount to avoid device busy problems

Quoted 62 lines · Stefan Behrens
Quoted 61 lines · On 4/13/2012 11:49 AM, [email protected] wrote:

From: Tom Marek <[email protected]>

Some tests might fail because of 'device or resource busy' when unmounting either the SCRATCH or the TEST device. The reason this happenes is that some processes might not have time to finish properly, or they are still waiting for IO. The sync command was added before unmount into _scratch_unmount() and umount_or_remount_ro which should help processes to finish before unmounting takes place and thus it solves the problem. This fixes for example tests 226 and 247.

Test 226 uses plain umount command which suffers from exactly the same problem as described above. Use fixed _scratch_unmount() instead of plain umount fixes this problem.

---
 226       |    4 ++--
 common.rc |    5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
226 +2 -2
index 6f28ac9..f8847c6 100755
@@ -61,7 +61,7 @@ for I in `seq 1 $loops`; do
 done
 
 echo
-umount $SCRATCH_DEV
+_scratch_unmount
 _scratch_mount
 
 echo "--> $loops direct 64m writes in a loop"
@@ -73,7 +73,7 @@ for I in `seq 1 $loops`; do
 done
 
 echo
-umount $SCRATCH_DEV
+_scratch_unmount
 
 status=0
 exit
common.rc +2 -0
index cab0b64..e56e5bc 100644
@@ -255,6 +255,8 @@ _scratch_mount()
 
 _scratch_unmount()
 {
+    # Run sync to give processes some time to finish before unmount
+    sync
     $UMOUNT_PROG $SCRATCH_DEV
 }
 
@@ -1051,6 +1053,9 @@ _umount_or_remount_ro()
     device=$1
     mountpoint=`_is_mounted $device`
 
Quoted 9 lines

common.rc _umount_or_remount_ro() · line 1061

Quoted 6 lines
common.rc +3 -0
+    # Run sync to give processes some time to finish before unmount
+    sync
+
     if [ $USE_REMOUNT -eq 0 ]; then
         $UMOUNT_PROG $device
     else

If a xfstest process is still running when _scratch_umount() is called, that xfstest is wrong and needs to be fixed IMO.

I agree, however some tests does not explicitly wait for all processes to finish. It is kind of hard to see why 226 has this problem, since there are no processes running on background, but sync certainly seems to help. It seems to be just a matter of timing though.

Quoted 4 lines

If a system or filesystem thread is still running and umount fails to handle it, the system or filesystem needs to be fixed IMO.

xfstests shall uncover issues, not hide them.

I do not think this is fs issue at all.

Thanks
-Lukas

Quoted 8 lines

sync before umount should never be required.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Signature · 4 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#7 lore raw

Re: [PATCH 4/5] xfstests: sync before umount to avoid device busy problems

Quoted 15 lines · Lukas Czerner
Quoted 14 lines · Stefan Behrens
Quoted 13 lines · On 4/13/2012 11:49 AM, [email protected] wrote:

From: Tom Marek <[email protected]>

Some tests might fail because of 'device or resource busy' when unmounting either the SCRATCH or the TEST device. The reason this happenes is that some processes might not have time to finish properly, or they are still waiting for IO. The sync command was added before unmount into _scratch_unmount() and umount_or_remount_ro which should help processes to finish before unmounting takes place and thus it solves the problem. This fixes for example tests 226 and 247.

Test 226 uses plain umount command which suffers from exactly the same problem as described above. Use fixed _scratch_unmount() instead of plain umount fixes this problem.

....

Quoted 8 lines
Quoted 3 lines

If a xfstest process is still running when _scratch_umount() is called, that xfstest is wrong and needs to be fixed IMO.

I agree, however some tests does not explicitly wait for all processes to finish. It is kind of hard to see why 226 has this problem, since there are no processes running on background, but sync certainly seems to help. It seems to be just a matter of timing though.

Which indicates a problem that needs to be understood, not hidden.

Quoted 6 lines
Quoted 4 lines

If a system or filesystem thread is still running and umount fails to handle it, the system or filesystem needs to be fixed IMO.

xfstests shall uncover issues, not hide them.

I do not think this is fs issue at all.

There are no background threads in 226, so if the unmount is failing then there is something wrong with the unmount process. Indeed, 226 is doing direct Io writes prior to unmount, so the only dirty objects should be the inode and free space indexing metadata. If unmount is failing to handle this, we need to know why....

So I definitely agree with Stefan on this one - adding a sync before unmount looks like hiding a problem rather than solving it...

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#8 lore raw

Re: [PATCH 4/5] xfstests: sync before umount to avoid device busy problems

Quoted 35 lines · Dave Chinner
Quoted 15 lines · Lukas Czerner
Quoted 14 lines · Stefan Behrens
Quoted 13 lines · On 4/13/2012 11:49 AM, [email protected] wrote:

From: Tom Marek <[email protected]>

Some tests might fail because of 'device or resource busy' when unmounting either the SCRATCH or the TEST device. The reason this happenes is that some processes might not have time to finish properly, or they are still waiting for IO. The sync command was added before unmount into _scratch_unmount() and umount_or_remount_ro which should help processes to finish before unmounting takes place and thus it solves the problem. This fixes for example tests 226 and 247.

Test 226 uses plain umount command which suffers from exactly the same problem as described above. Use fixed _scratch_unmount() instead of plain umount fixes this problem.

....

Quoted 8 lines
Quoted 3 lines

If a xfstest process is still running when _scratch_umount() is called, that xfstest is wrong and needs to be fixed IMO.

I agree, however some tests does not explicitly wait for all processes to finish. It is kind of hard to see why 226 has this problem, since there are no processes running on background, but sync certainly seems to help. It seems to be just a matter of timing though.

Which indicates a problem that needs to be understood, not hidden.

Quoted 6 lines
Quoted 4 lines

If a system or filesystem thread is still running and umount fails to handle it, the system or filesystem needs to be fixed IMO.

xfstests shall uncover issues, not hide them.

I do not think this is fs issue at all.

Quoted 8 lines

There are no background threads in 226, so if the unmount is failing then there is something wrong with the unmount process. Indeed, 226 is doing direct Io writes prior to unmount, so the only dirty objects should be the inode and free space indexing metadata. If unmount is failing to handle this, we need to know why....

So I definitely agree with Stefan on this one - adding a sync before unmount looks like hiding a problem rather than solving it...

Hmm ok, you're right. Since there is no background process we have to see what is actually holding back unmount from proceeding successfully. Tom, will you look into this please ?

Thanks!
-Lukas

Quoted 5 lines

Cheers,

Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#9 lore raw

Re: [PATCH 4/5] xfstests: sync before umount to avoid device busy problems

In reply to Stefan Behrens
Quoted 73 lines · Stefan Behrens
Quoted 58 lines · On 4/13/2012 11:49 AM, [email protected] wrote:

From: Tom Marek<[email protected]>

Some tests might fail because of 'device or resource busy' when unmounting either the SCRATCH or the TEST device. The reason this happenes is that some processes might not have time to finish properly, or they are still waiting for IO. The sync command was added before unmount into _scratch_unmount() and umount_or_remount_ro which should help processes to finish before unmounting takes place and thus it solves the problem. This fixes for example tests 226 and 247.

Test 226 uses plain umount command which suffers from exactly the same problem as described above. Use fixed _scratch_unmount() instead of plain umount fixes this problem.

---
  226       |    4 ++--
  common.rc |    5 +++++
  2 files changed, 7 insertions(+), 2 deletions(-)
226 +2 -2
index 6f28ac9..f8847c6 100755
@@ -61,7 +61,7 @@ for I in `seq 1 $loops`; do
  done
 
  echo
-umount $SCRATCH_DEV
+_scratch_unmount
  _scratch_mount
 
  echo "-->  $loops direct 64m writes in a loop"
@@ -73,7 +73,7 @@ for I in `seq 1 $loops`; do
  done
 
  echo
-umount $SCRATCH_DEV
+_scratch_unmount
 
  status=0
  exit
common.rc +2 -0
index cab0b64..e56e5bc 100644
@@ -255,6 +255,8 @@ _scratch_mount()
 
  _scratch_unmount()
  {
+    # Run sync to give processes some time to finish before unmount
+    sync
      $UMOUNT_PROG $SCRATCH_DEV
  }
 

common.rc _umount_or_remount_ro() · line 1061

Quoted 9 lines
common.rc +3 -0
@@ -1051,6 +1053,9 @@ _umount_or_remount_ro()
      device=$1
      mountpoint=`_is_mounted $device`
 
+    # Run sync to give processes some time to finish before unmount
+    sync
+
      if [ $USE_REMOUNT -eq 0 ]; then
          $UMOUNT_PROG $device
      else

If a xfstest process is still running when _scratch_umount() is called, that xfstest is wrong and needs to be fixed IMO.
If a system or filesystem thread is still running and umount fails to handle it, the system or filesystem needs to be fixed IMO.

Quoted 3 lines

xfstests shall uncover issues, not hide them.

sync before umount should never be required.

The reason i added sync before umount is that at the end of a lot of tests the function
_umount_scratch is called. And sometimes there may be some delayed operations when the umount is called and it fails -> test fails which is not the problem of fs but only a matter of finishing everything.

Tom

Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#10 lore raw

PATCH 5/5 xfstests 273: fix of reading scratch size and removing lost+found

In reply to [email protected]

From: Tom Marek <[email protected]>

There were two reasons why test 273 was failing. Firstrly, it was removing everything from SCRATCH_MNT directory at the beginning of tests including the lost+found directory. This cauesd error while checking scratch fs after finishing test. Secondly, obtaining of the partition size was not counting with with behaviour of df utility which may split the line containg informations about one partition when it is too long thus it may have returned nothing.

First problem was solved with removing all unnecessary rm -rf commands and the second one was fixed with alternative awk script which is able to deal with any line splitting possible.

---
 273 |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
273 +4 -6
index 2965132..86262d1 100755
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
 	cd /
-	rm -rf $SCRATCH_MNT/* $tmp.*
+	rm -rf $tmp.*
 	_scratch_unmount
 }
 
@@ -66,9 +66,9 @@ _file_create()
 		exit
 	fi
 
-	cd $SCRATCH_MNT/origin
+	cd $SCRATCH_MNT
 
-	_disksize=`df --block-size=1 | grep $SCRATCH_DEV | awk '{print $2}'`
+	_disksize=`df --block-size=1 $SCRATCH_DEV | awk -v sd=$SCRATCH_DEV 'BEGIN{c=0}{for(i=1;i<=NF;++i){a[c]=$i;++c}}END{for(entry in a){if(a[entry] ~ sd){print a[entry + 3]; break}}}'`
 	_disksize=$(($_disksize / 3))
 	_num=$(($_disksize / $count / $threads / 4096))
 	_count=$count
@@ -105,8 +105,6 @@ _do_workload()
 {
 	_pids=""
 	_pid=1
-	
-	rm -rf $SCRATCH_MNT/*
 
 	_threads_set
 	_file_create
@@ -134,7 +132,7 @@ echo "------------------------------"
 
 rm -f $seq.full
 
-umount $SCRATCH_DEV 2>/dev/null
+_scratch_unmount 2>/dev/null
 _scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
 _scratch_mount
 
Signature · 6 lines
1.7.7.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by Christoph Hellwig on v1 1/5
#11 lore raw
In reply to [email protected]
Quoted 11 lines · On 4/13/12 4:49 AM, [email protected] wrote:

From: Tom Marek <[email protected]>

Tests number 062 was supposed to work with ext4 fs but there were some problems in it - Tests haven't considered existence of lost+found directory in ext4. Also when scratch was mounted with SELinux context test failed because fgetattr returns SELinux extended attributes. And when fgetattr is run with recursive flag it's output might change between file systems due to different file ordering. Fix this by sorting the output manually. Also all lines containing SELinux and lost+found were removed from output.

Have you run the latest xfstests? This looks a lot like:

commit 2fb1c931a6090f646afa44e4ce3f1f9815af9067

Author: Eric Sandeen <[email protected]>
Date:   Fri Jan 27 12:28:20 2012 -0600

062: Sort recursive getfattr output

Test 062 was made "generic" a while back, but it fails on any filesystem which returns getfattr -R results (aka readdir results) in something other than inode-order.

With a little awk-fu we can sort the records from getfattr -R so that the output is the same for xfs as well as ext4, etc.

Also filter out lost+found which extN creates at mkfs time, but some other filesystems do not.

-Eric

Quoted 252 lines
---
 062     |   50 ++++++++++++++++++++++++++---------
 062.out |   90 +++++++++++++++++++++++++++++++-------------------------------
 2 files changed, 82 insertions(+), 58 deletions(-)
062 +37 -13
index f666e1b..116296b 100755
@@ -46,6 +46,30 @@ _cleanup()
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
+# remove "security.selinux=..." because it is not installed on all systems
+# and it not relevant to this test
+_remove_selinux(){
+	egrep -v '^(selinux|security\.selinux)'
+}
+
+# sort getfattr output and remove entries containing only selinux attributes
+_sort_getfattr(){
+	awk '
+	BEGIN{
+		RS=""
+	}
+	{
+		a[FNR]=$0
+	}
+	END{
+		n = asort(a);
+		for(i = 1; i <= n; ++i){
+			if (a[i] ~ /# file: SCRATCH_MNT[^\n]*\nsecurity.selinux[^\n]*\n/)
+				print a[i] "\n"
+		}
+	}'
+}
+
 getfattr()
 {
     $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch
@@ -67,7 +91,7 @@ _create_test_bed()
 	mknod $SCRATCH_MNT/dev/c c 0 0
 	mknod $SCRATCH_MNT/dev/p p
 	# sanity check
-	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 # real QA test starts here
@@ -102,7 +126,7 @@ for nsp in $ATTR_MODES; do
 		echo "*** set/get one initially empty attribute"
 
 		setfattr -h -n $nsp.name $SCRATCH_MNT/$inode
-		getfattr -m $nsp $SCRATCH_MNT/$inode
+		getfattr -m $nsp $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** overwrite empty, set several new attributes"
 		setfattr -h -n $nsp.name -v 0xbabe $SCRATCH_MNT/$inode
@@ -110,33 +134,33 @@ for nsp in $ATTR_MODES; do
 		setfattr -h -n $nsp.name3 -v 0xdeface $SCRATCH_MNT/$inode
 
 		echo "*** fetch several attribute names and values (hex)"
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** fetch several attribute names and values (base64)"
-		getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** shrink value of an existing attribute"
 		setfattr -h -n $nsp.name2 -v 0xdeaf $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** grow value of existing attribute"
 		setfattr -h -n $nsp.name2 -v 0xdecade $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** set an empty value for second attribute"
 		setfattr -h -n $nsp.name2 $SCRATCH_MNT/$inode
-		getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** overwrite empty value"
 		setfattr -h -n $nsp.name2 -v 0xcafe $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** remove attribute"
 		setfattr -h -x $nsp.name2 $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** final list (strings, type=$inode, nsp=$nsp)"
-		getfattr -m '.' -e hex $SCRATCH_MNT/$inode
+		getfattr -m '.' -e hex $SCRATCH_MNT/$inode | _sort_getfattr | _remove_selinux
 
 	done
 done
@@ -160,18 +184,18 @@ _extend_test_bed()
 	# whack a symlink in the middle, just to be difficult
 	ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
 	# dump out our new starting point
-	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 _extend_test_bed
 
 echo
 echo "*** directory descent with us following symlinks"
-getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
 
 echo
 echo "*** directory descent without following symlinks"
-getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
 
 
 # 
062.out +40 -43
index 699254a..8cc3c65 100644
@@ -508,21 +508,21 @@ SCRATCH_MNT/lnk
 SCRATCH_MNT/reg
 
 *** directory descent with us following symlinks
-# file: SCRATCH_MNT/reg
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
+# file: SCRATCH_MNT/descend
+user.1=0x3233
+user.x=0x797a
 
-# file: SCRATCH_MNT/dir
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
+# file: SCRATCH_MNT/descend/and/ascend
+trusted.9=0x3837
+trusted.a=0x6263
 
-# file: SCRATCH_MNT/lnk
-trusted.name=0xbabe
-trusted.name3=0xdeface
+# file: SCRATCH_MNT/descend/down
+user.1=0x3233
+user.x=0x797a
+
+# file: SCRATCH_MNT/descend/down/here
+user.1=0x3233
+user.x=0x797a
 
 # file: SCRATCH_MNT/dev/b
 trusted.name=0xbabe
@@ -536,6 +536,12 @@ trusted.name3=0xdeface
 trusted.name=0xbabe
 trusted.name3=0xdeface
 
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
 # file: SCRATCH_MNT/here
 trusted.9=0x3837
 trusted.a=0x6263
@@ -548,6 +554,18 @@ trusted.a=0x6263
 trusted.9=0x3837
 trusted.a=0x6263
 
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface
+
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
+
+*** directory descent without following symlinks
 # file: SCRATCH_MNT/descend
 user.1=0x3233
 user.x=0x797a
@@ -560,28 +578,6 @@ user.x=0x797a
 user.1=0x3233
 user.x=0x797a
 
-# file: SCRATCH_MNT/descend/and/ascend
-trusted.9=0x3837
-trusted.a=0x6263
-
-
-*** directory descent without following symlinks
-# file: SCRATCH_MNT/reg
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
-
-# file: SCRATCH_MNT/dir
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
-
-# file: SCRATCH_MNT/lnk
-trusted.name=0xbabe
-trusted.name3=0xdeface
-
 # file: SCRATCH_MNT/dev/b
 trusted.name=0xbabe
 trusted.name3=0xdeface
@@ -594,6 +590,12 @@ trusted.name3=0xdeface
 trusted.name=0xbabe
 trusted.name3=0xdeface
 
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
 # file: SCRATCH_MNT/here
 trusted.9=0x3837
 trusted.a=0x6263
@@ -606,17 +608,15 @@ trusted.a=0x6263
 trusted.9=0x3837
 trusted.a=0x6263
 
-# file: SCRATCH_MNT/descend
-user.1=0x3233
-user.x=0x797a
-
-# file: SCRATCH_MNT/descend/down
-user.1=0x3233
-user.x=0x797a
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface
 
-# file: SCRATCH_MNT/descend/down/here

062.out trusted.a=0x6263 · line 622

Quoted 10 lines
062.out +5 -2
-user.1=0x3233
-user.x=0x797a
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
 
 
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#12 lore raw
Quoted 25 lines · Eric Sandeen
Quoted 11 lines · On 4/13/12 4:49 AM, [email protected] wrote:

From: Tom Marek <[email protected]>

Tests number 062 was supposed to work with ext4 fs but there were some problems in it - Tests haven't considered existence of lost+found directory in ext4. Also when scratch was mounted with SELinux context test failed because fgetattr returns SELinux extended attributes. And when fgetattr is run with recursive flag it's output might change between file systems due to different file ordering. Fix this by sorting the output manually. Also all lines containing SELinux and lost+found were removed from output.

Have you run the latest xfstests? This looks a lot like:

commit 2fb1c931a6090f646afa44e4ce3f1f9815af9067

Author: Eric Sandeen <[email protected]>
Date:   Fri Jan 27 12:28:20 2012 -0600

062: Sort recursive getfattr output

Test 062 was made "generic" a while back, but it fails on any filesystem which returns getfattr -R results (aka readdir results) in something other than inode-order.

Quoted 8 lines

With a little awk-fu we can sort the records from getfattr -R so that the output is the same for xfs as well as ext4, etc.

Also filter out lost+found which extN creates at mkfs time, but some other filesystems do not.

Oh, and as for selinux, scratch should be getting mounted with an fs-wide selinux context mount option, I think?

-Eric

Quoted 1 line

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#13 lore raw
In reply to Eric Sandeen
Quoted 28 lines · Eric Sandeen
Quoted 11 lines · On 4/13/12 4:49 AM, [email protected] wrote:

From: Tom Marek <[email protected]>

Tests number 062 was supposed to work with ext4 fs but there were some problems in it - Tests haven't considered existence of lost+found directory in ext4. Also when scratch was mounted with SELinux context test failed because fgetattr returns SELinux extended attributes. And when fgetattr is run with recursive flag it's output might change between file systems due to different file ordering. Fix this by sorting the output manually. Also all lines containing SELinux and lost+found were removed from output.

Have you run the latest xfstests? This looks a lot like:

commit 2fb1c931a6090f646afa44e4ce3f1f9815af9067

Author: Eric Sandeen <[email protected]>
Date:   Fri Jan 27 12:28:20 2012 -0600

062: Sort recursive getfattr output

Test 062 was made "generic" a while back, but it fails on any filesystem which returns getfattr -R results (aka readdir results) in something other than inode-order.

With a little awk-fu we can sort the records from getfattr -R so that the output is the same for xfs as well as ext4, etc.

Quoted 7 lines

Also filter out lost+found which extN creates at mkfs time, but some other filesystems do not.

-Eric

Hi Eric,

I have latest xfstests from git://oss.sgi.com/xfs/cmds/xfstests which I found here http://xfs.org/index.php/Getting_the_latest_source_code but your commit is not there. I can see it on the list though, so this patch can be dropped.

Thanks!
-Lukas

Quoted 265 lines
Quoted 263 lines
---
 062     |   50 ++++++++++++++++++++++++++---------
 062.out |   90 +++++++++++++++++++++++++++++++-------------------------------
 2 files changed, 82 insertions(+), 58 deletions(-)
062 +37 -13
index f666e1b..116296b 100755
@@ -46,6 +46,30 @@ _cleanup()
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
+# remove "security.selinux=..." because it is not installed on all systems
+# and it not relevant to this test
+_remove_selinux(){
+	egrep -v '^(selinux|security\.selinux)'
+}
+
+# sort getfattr output and remove entries containing only selinux attributes
+_sort_getfattr(){
+	awk '
+	BEGIN{
+		RS=""
+	}
+	{
+		a[FNR]=$0
+	}
+	END{
+		n = asort(a);
+		for(i = 1; i <= n; ++i){
+			if (a[i] ~ /# file: SCRATCH_MNT[^\n]*\nsecurity.selinux[^\n]*\n/)
+				print a[i] "\n"
+		}
+	}'
+}
+
 getfattr()
 {
     $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch
@@ -67,7 +91,7 @@ _create_test_bed()
 	mknod $SCRATCH_MNT/dev/c c 0 0
 	mknod $SCRATCH_MNT/dev/p p
 	# sanity check
-	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 # real QA test starts here
@@ -102,7 +126,7 @@ for nsp in $ATTR_MODES; do
 		echo "*** set/get one initially empty attribute"
 
 		setfattr -h -n $nsp.name $SCRATCH_MNT/$inode
-		getfattr -m $nsp $SCRATCH_MNT/$inode
+		getfattr -m $nsp $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** overwrite empty, set several new attributes"
 		setfattr -h -n $nsp.name -v 0xbabe $SCRATCH_MNT/$inode
@@ -110,33 +134,33 @@ for nsp in $ATTR_MODES; do
 		setfattr -h -n $nsp.name3 -v 0xdeface $SCRATCH_MNT/$inode
 
 		echo "*** fetch several attribute names and values (hex)"
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** fetch several attribute names and values (base64)"
-		getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** shrink value of an existing attribute"
 		setfattr -h -n $nsp.name2 -v 0xdeaf $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** grow value of existing attribute"
 		setfattr -h -n $nsp.name2 -v 0xdecade $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** set an empty value for second attribute"
 		setfattr -h -n $nsp.name2 $SCRATCH_MNT/$inode
-		getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** overwrite empty value"
 		setfattr -h -n $nsp.name2 -v 0xcafe $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** remove attribute"
 		setfattr -h -x $nsp.name2 $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** final list (strings, type=$inode, nsp=$nsp)"
-		getfattr -m '.' -e hex $SCRATCH_MNT/$inode
+		getfattr -m '.' -e hex $SCRATCH_MNT/$inode | _sort_getfattr | _remove_selinux
 
 	done
 done
@@ -160,18 +184,18 @@ _extend_test_bed()
 	# whack a symlink in the middle, just to be difficult
 	ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
 	# dump out our new starting point
-	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 _extend_test_bed
 
 echo
 echo "*** directory descent with us following symlinks"
-getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
 
 echo
 echo "*** directory descent without following symlinks"
-getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
 
 
 # 
062.out +45 -45
index 699254a..8cc3c65 100644
@@ -508,21 +508,21 @@ SCRATCH_MNT/lnk
 SCRATCH_MNT/reg
 
 *** directory descent with us following symlinks
-# file: SCRATCH_MNT/reg
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
+# file: SCRATCH_MNT/descend
+user.1=0x3233
+user.x=0x797a
 
-# file: SCRATCH_MNT/dir
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
+# file: SCRATCH_MNT/descend/and/ascend
+trusted.9=0x3837
+trusted.a=0x6263
 
-# file: SCRATCH_MNT/lnk
-trusted.name=0xbabe
-trusted.name3=0xdeface
+# file: SCRATCH_MNT/descend/down
+user.1=0x3233
+user.x=0x797a
+
+# file: SCRATCH_MNT/descend/down/here
+user.1=0x3233
+user.x=0x797a
 
 # file: SCRATCH_MNT/dev/b
 trusted.name=0xbabe
@@ -536,6 +536,12 @@ trusted.name3=0xdeface
 trusted.name=0xbabe
 trusted.name3=0xdeface
 
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
 # file: SCRATCH_MNT/here
 trusted.9=0x3837
 trusted.a=0x6263
@@ -548,6 +554,18 @@ trusted.a=0x6263
 trusted.9=0x3837
 trusted.a=0x6263
 
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface
+
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
+
+*** directory descent without following symlinks
 # file: SCRATCH_MNT/descend
 user.1=0x3233
 user.x=0x797a
@@ -560,28 +578,6 @@ user.x=0x797a
 user.1=0x3233
 user.x=0x797a
 
-# file: SCRATCH_MNT/descend/and/ascend
-trusted.9=0x3837
-trusted.a=0x6263
-
-
-*** directory descent without following symlinks
-# file: SCRATCH_MNT/reg
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
-
-# file: SCRATCH_MNT/dir
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
-
-# file: SCRATCH_MNT/lnk
-trusted.name=0xbabe
-trusted.name3=0xdeface
-
 # file: SCRATCH_MNT/dev/b
 trusted.name=0xbabe
 trusted.name3=0xdeface
@@ -594,6 +590,12 @@ trusted.name3=0xdeface
 trusted.name=0xbabe
 trusted.name3=0xdeface
 
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
 # file: SCRATCH_MNT/here
 trusted.9=0x3837
 trusted.a=0x6263
@@ -606,17 +608,15 @@ trusted.a=0x6263
 trusted.9=0x3837
 trusted.a=0x6263
 
-# file: SCRATCH_MNT/descend
-user.1=0x3233
-user.x=0x797a
-
-# file: SCRATCH_MNT/descend/down
-user.1=0x3233
-user.x=0x797a
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface
 
-# file: SCRATCH_MNT/descend/down/here
-user.1=0x3233
-user.x=0x797a
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
 
 
 
Signature · 4 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#14 lore raw
Quoted 20 lines · Lukas Czerner
Quoted 18 lines · Eric Sandeen
Quoted 11 lines · On 4/13/12 4:49 AM, [email protected] wrote:

From: Tom Marek <[email protected]>

Tests number 062 was supposed to work with ext4 fs but there were some problems in it - Tests haven't considered existence of lost+found directory in ext4. Also when scratch was mounted with SELinux context test failed because fgetattr returns SELinux extended attributes. And when fgetattr is run with recursive flag it's output might change between file systems due to different file ordering. Fix this by sorting the output manually. Also all lines containing SELinux and lost+found were removed from output.

Have you run the latest xfstests? This looks a lot like:

commit 2fb1c931a6090f646afa44e4ce3f1f9815af9067

Author: Eric Sandeen <[email protected]>
Date:   Fri Jan 27 12:28:20 2012 -0600

...

Quoted 6 lines

Hi Eric,

I have latest xfstests from git://oss.sgi.com/xfs/cmds/xfstests which I found here http://xfs.org/index.php/Getting_the_latest_source_code but your commit is not there. I can see it on the list though, so this patch can be dropped.

git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git

usually contains the latest. Looks like SGI hasn't pulled from there since Thu, 10 Nov 2011.

Ben, can you get oss up to date?

-Eric

Quoted 269 lines

Thanks!
-Lukas

Quoted 265 lines
Quoted 263 lines
---
 062     |   50 ++++++++++++++++++++++++++---------
 062.out |   90 +++++++++++++++++++++++++++++++-------------------------------
 2 files changed, 82 insertions(+), 58 deletions(-)
062 +37 -13
index f666e1b..116296b 100755
@@ -46,6 +46,30 @@ _cleanup()
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
+# remove "security.selinux=..." because it is not installed on all systems
+# and it not relevant to this test
+_remove_selinux(){
+	egrep -v '^(selinux|security\.selinux)'
+}
+
+# sort getfattr output and remove entries containing only selinux attributes
+_sort_getfattr(){
+	awk '
+	BEGIN{
+		RS=""
+	}
+	{
+		a[FNR]=$0
+	}
+	END{
+		n = asort(a);
+		for(i = 1; i <= n; ++i){
+			if (a[i] ~ /# file: SCRATCH_MNT[^\n]*\nsecurity.selinux[^\n]*\n/)
+				print a[i] "\n"
+		}
+	}'
+}
+
 getfattr()
 {
     $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch
@@ -67,7 +91,7 @@ _create_test_bed()
 	mknod $SCRATCH_MNT/dev/c c 0 0
 	mknod $SCRATCH_MNT/dev/p p
 	# sanity check
-	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 # real QA test starts here
@@ -102,7 +126,7 @@ for nsp in $ATTR_MODES; do
 		echo "*** set/get one initially empty attribute"
 
 		setfattr -h -n $nsp.name $SCRATCH_MNT/$inode
-		getfattr -m $nsp $SCRATCH_MNT/$inode
+		getfattr -m $nsp $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** overwrite empty, set several new attributes"
 		setfattr -h -n $nsp.name -v 0xbabe $SCRATCH_MNT/$inode
@@ -110,33 +134,33 @@ for nsp in $ATTR_MODES; do
 		setfattr -h -n $nsp.name3 -v 0xdeface $SCRATCH_MNT/$inode
 
 		echo "*** fetch several attribute names and values (hex)"
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** fetch several attribute names and values (base64)"
-		getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e base64 $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** shrink value of an existing attribute"
 		setfattr -h -n $nsp.name2 -v 0xdeaf $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** grow value of existing attribute"
 		setfattr -h -n $nsp.name2 -v 0xdecade $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode
+		getfattr -m $nsp -e hex $SCRATCH_MNT/$inode | _remove_selinux
 
 		echo "*** set an empty value for second attribute"
 		setfattr -h -n $nsp.name2 $SCRATCH_MNT/$inode
-		getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** overwrite empty value"
 		setfattr -h -n $nsp.name2 -v 0xcafe $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** remove attribute"
 		setfattr -h -x $nsp.name2 $SCRATCH_MNT/$inode
-		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
+		getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter | _remove_selinux
 
 		echo "*** final list (strings, type=$inode, nsp=$nsp)"
-		getfattr -m '.' -e hex $SCRATCH_MNT/$inode
+		getfattr -m '.' -e hex $SCRATCH_MNT/$inode | _sort_getfattr | _remove_selinux
 
 	done
 done
@@ -160,18 +184,18 @@ _extend_test_bed()
 	# whack a symlink in the middle, just to be difficult
 	ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
 	# dump out our new starting point
-	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
+	find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
 }
 
 _extend_test_bed
 
 echo
 echo "*** directory descent with us following symlinks"
-getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
 
 echo
 echo "*** directory descent without following symlinks"
-getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT
+getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr | _remove_selinux
 
 
 # 
062.out +45 -45
index 699254a..8cc3c65 100644
@@ -508,21 +508,21 @@ SCRATCH_MNT/lnk
 SCRATCH_MNT/reg
 
 *** directory descent with us following symlinks
-# file: SCRATCH_MNT/reg
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
+# file: SCRATCH_MNT/descend
+user.1=0x3233
+user.x=0x797a
 
-# file: SCRATCH_MNT/dir
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
+# file: SCRATCH_MNT/descend/and/ascend
+trusted.9=0x3837
+trusted.a=0x6263
 
-# file: SCRATCH_MNT/lnk
-trusted.name=0xbabe
-trusted.name3=0xdeface
+# file: SCRATCH_MNT/descend/down
+user.1=0x3233
+user.x=0x797a
+
+# file: SCRATCH_MNT/descend/down/here
+user.1=0x3233
+user.x=0x797a
 
 # file: SCRATCH_MNT/dev/b
 trusted.name=0xbabe
@@ -536,6 +536,12 @@ trusted.name3=0xdeface
 trusted.name=0xbabe
 trusted.name3=0xdeface
 
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
 # file: SCRATCH_MNT/here
 trusted.9=0x3837
 trusted.a=0x6263
@@ -548,6 +554,18 @@ trusted.a=0x6263
 trusted.9=0x3837
 trusted.a=0x6263
 
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface
+
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
+
+*** directory descent without following symlinks
 # file: SCRATCH_MNT/descend
 user.1=0x3233
 user.x=0x797a
@@ -560,28 +578,6 @@ user.x=0x797a
 user.1=0x3233
 user.x=0x797a
 
-# file: SCRATCH_MNT/descend/and/ascend
-trusted.9=0x3837
-trusted.a=0x6263
-
-
-*** directory descent without following symlinks
-# file: SCRATCH_MNT/reg
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
-
-# file: SCRATCH_MNT/dir
-trusted.name=0xbabe
-trusted.name3=0xdeface
-user.name=0xbabe
-user.name3=0xdeface
-
-# file: SCRATCH_MNT/lnk
-trusted.name=0xbabe
-trusted.name3=0xdeface
-
 # file: SCRATCH_MNT/dev/b
 trusted.name=0xbabe
 trusted.name3=0xdeface
@@ -594,6 +590,12 @@ trusted.name3=0xdeface
 trusted.name=0xbabe
 trusted.name3=0xdeface
 
+# file: SCRATCH_MNT/dir
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
+
 # file: SCRATCH_MNT/here
 trusted.9=0x3837
 trusted.a=0x6263
@@ -606,17 +608,15 @@ trusted.a=0x6263
 trusted.9=0x3837
 trusted.a=0x6263
 
-# file: SCRATCH_MNT/descend
-user.1=0x3233
-user.x=0x797a
-
-# file: SCRATCH_MNT/descend/down
-user.1=0x3233
-user.x=0x797a
+# file: SCRATCH_MNT/lnk
+trusted.name=0xbabe
+trusted.name3=0xdeface
 
-# file: SCRATCH_MNT/descend/down/here
-user.1=0x3233
-user.x=0x797a
+# file: SCRATCH_MNT/reg
+trusted.name=0xbabe
+trusted.name3=0xdeface
+user.name=0xbabe
+user.name3=0xdeface
 
 
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs