public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] overlay/40: clean up properly after setting immutable
@ 2018-04-16 10:41 Miklos Szeredi
  2018-04-16 10:41 ` [PATCH 2/2] overlay/013: do not expect failure Miklos Szeredi
  2018-04-16 15:27 ` [PATCH 1/2] overlay/40: clean up properly after setting immutable Amir Goldstein
  0 siblings, 2 replies; 4+ messages in thread
From: Miklos Szeredi @ 2018-04-16 10:41 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, Eryu Guan, Amir Goldstein

Test program expects only immutable on lower layer (test failure), but does
not expect the immutable file to be on the upper layer.  The later case is
actually what *should* happen, except overlayfs didn't properly implement
this case yet (but is now in the works).

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
 tests/overlay/040 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/overlay/040 b/tests/overlay/040
index 369fef3c3a47..4fff7570c2c6 100755
--- a/tests/overlay/040
+++ b/tests/overlay/040
@@ -41,7 +41,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
 	cd /
-	$CHATTR_PROG -i $lowerdir/foo
+	$CHATTR_PROG -i $lowerdir/foo > /dev/null 2>&1
+	$CHATTR_PROG -i $upperdir/foo > /dev/null 2>&1
 	rm -f $tmp.*
 }
 
@@ -63,6 +64,7 @@ _scratch_mkfs
 
 # prepare lower test file
 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
+upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
 mkdir -p $lowerdir
 touch $lowerdir/foo
 
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] overlay/013: do not expect failure
  2018-04-16 10:41 [PATCH 1/2] overlay/40: clean up properly after setting immutable Miklos Szeredi
@ 2018-04-16 10:41 ` Miklos Szeredi
  2018-04-16 15:27   ` Amir Goldstein
  2018-04-16 15:27 ` [PATCH 1/2] overlay/40: clean up properly after setting immutable Amir Goldstein
  1 sibling, 1 reply; 4+ messages in thread
From: Miklos Szeredi @ 2018-04-16 10:41 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, Eryu Guan, Amir Goldstein

Current test expects test_lower to fail with:

  truncate(test_lower) should have failed

While it is sort of okay to fail like that (the above expectation basically
acknowledges this weirdness in the overlayfs implementation), it is by no
means the only correct behavior: it is also correct for the test to
succeed (i.e. truncation fails with ETXTBSY).

So add an option to t_truncate_self.c that allows both success and failure,
but obviously not SIGSEGV, which is what a we'd get in a real failure mode.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
 src/t_truncate_self.c | 3 +++
 tests/overlay/013     | 3 ++-
 tests/overlay/013.out | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/t_truncate_self.c b/src/t_truncate_self.c
index 3f1c8e6fde80..a11f7d5a7d48 100644
--- a/src/t_truncate_self.c
+++ b/src/t_truncate_self.c
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <string.h>
 #include <errno.h>
 #include <unistd.h>
 #include <libgen.h>
@@ -10,6 +11,8 @@ int main(int argc, char *argv[])
 
 	ret = truncate(argv[0], 4096);
 	if (ret != -1) {
+		if (argc == 2 && strcmp(argv[1], "--may-succeed") == 0)
+			return 0;
 		fprintf(stderr, "truncate(%s) should have failed\n",
 			progname);
 		return 1;
diff --git a/tests/overlay/013 b/tests/overlay/013
index de0fc26a1c88..8ff438d8f4f6 100755
--- a/tests/overlay/013
+++ b/tests/overlay/013
@@ -65,9 +65,10 @@ _scratch_mount
 
 # run test program from lower and upper dir
 # test programs truncate themselfs, all should fail with ETXTBSY
-$SCRATCH_MNT/test_lower
+$SCRATCH_MNT/test_lower --may-succeed
 $SCRATCH_MNT/test_upper
 
 # success, all done
+echo "Silence is golden"
 status=0
 exit
diff --git a/tests/overlay/013.out b/tests/overlay/013.out
index b2c7cc7e2cac..3e66423b5467 100644
--- a/tests/overlay/013.out
+++ b/tests/overlay/013.out
@@ -1,2 +1,2 @@
 QA output created by 013
-truncate(test_lower) should have failed
+Silence is golden
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] overlay/40: clean up properly after setting immutable
  2018-04-16 10:41 [PATCH 1/2] overlay/40: clean up properly after setting immutable Miklos Szeredi
  2018-04-16 10:41 ` [PATCH 2/2] overlay/013: do not expect failure Miklos Szeredi
@ 2018-04-16 15:27 ` Amir Goldstein
  1 sibling, 0 replies; 4+ messages in thread
From: Amir Goldstein @ 2018-04-16 15:27 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: fstests, overlayfs, Eryu Guan

On Mon, Apr 16, 2018 at 1:41 PM, Miklos Szeredi <mszeredi@redhat.com> wrote:
> Test program expects only immutable on lower layer (test failure), but does
> not expect the immutable file to be on the upper layer.  The later case is
> actually what *should* happen, except overlayfs didn't properly implement
> this case yet (but is now in the works).
>
> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Looks good.

Thanks,
Amir.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] overlay/013: do not expect failure
  2018-04-16 10:41 ` [PATCH 2/2] overlay/013: do not expect failure Miklos Szeredi
@ 2018-04-16 15:27   ` Amir Goldstein
  0 siblings, 0 replies; 4+ messages in thread
From: Amir Goldstein @ 2018-04-16 15:27 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: fstests, overlayfs, Eryu Guan

On Mon, Apr 16, 2018 at 1:41 PM, Miklos Szeredi <mszeredi@redhat.com> wrote:
> Current test expects test_lower to fail with:
>
>   truncate(test_lower) should have failed
>
> While it is sort of okay to fail like that (the above expectation basically
> acknowledges this weirdness in the overlayfs implementation), it is by no
> means the only correct behavior: it is also correct for the test to
> succeed (i.e. truncation fails with ETXTBSY).
>
> So add an option to t_truncate_self.c that allows both success and failure,
> but obviously not SIGSEGV, which is what a we'd get in a real failure mode.
>
> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Looks good.

Thanks,
Amir.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-16 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-16 10:41 [PATCH 1/2] overlay/40: clean up properly after setting immutable Miklos Szeredi
2018-04-16 10:41 ` [PATCH 2/2] overlay/013: do not expect failure Miklos Szeredi
2018-04-16 15:27   ` Amir Goldstein
2018-04-16 15:27 ` [PATCH 1/2] overlay/40: clean up properly after setting immutable Amir Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox