[CRIU] [PATCH 5/5] zdtm: now tempfs_overmounted will pass so remove crfail

Andrei Vagin avagin at virtuozzo.com
Thu Dec 7 18:07:04 MSK 2017


On Thu, Dec 07, 2017 at 09:28:04AM +0300, ptikhomirov wrote:
> Sorry, I can't find your patch, may be it is due to watching from a mobile.
> Please resend it somewhere.

Oops, I forgot to attach it.


> 
> 
> 
> Best regards, Tikhomirov Pavel.
> Andrew Vagin <avagin at virtuozzo.com> | От: 7 дек. 2017 г. 8:41 ДП | Сообщение:
> 
> 
>     Did you check my patch from a previous comment? Does it work now?
> 
>     On Wed, Dec 06, 2017 at 04:51:21PM +0300, Pavel Tikhomirov wrote:
>     > changes in v2:
>     > make test check that file on overmounted tmpfs mount is dumped
>     >
>     > Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
>     > ---
>     >  test/zdtm/static/tempfs_overmounted.c    | 22 ++++++++++++++++++++++
>     >  test/zdtm/static/tempfs_overmounted.desc |  2 +-
>     >  2 files changed, 23 insertions(+), 1 deletion(-)
>     >
>     > diff --git a/test/zdtm/static/tempfs_overmounted.c b/test/zdtm/static/
>     tempfs_overmounted.c
>     > index 56c3d2ed8..c9c1e2dae 100644
>     > --- a/test/zdtm/static/tempfs_overmounted.c
>     > +++ b/test/zdtm/static/tempfs_overmounted.c
>     > @@ -16,6 +16,9 @@ TEST_OPTION(dirname, string, "directory name", 1);
>     > 
>     >  int main(int argc, char **argv)
>     >  {
>     > + char testfile[PATH_MAX];
>     > + int fd;
>     > +
>     >  test_init(argc, argv);
>     > 
>     >  mkdir(dirname, 0700);
>     > @@ -23,6 +26,15 @@ int main(int argc, char **argv)
>     >  fail("Can't mount tmpfs");
>     >  return 1;
>     >  }
>     > +
>     > + snprintf(testfile, PATH_MAX, "%s/testfile", dirname);
>     > + fd = open(testfile, O_CREAT | O_EXCL, 0600);
>     > + if (fd < 0) {
>     > + fail("Can't create file");
>     > + return 1;
>     > + }
>     > + close(fd);
>     > +
>     >  if (mount("none", dirname, "tmpfs", 0, "") < 0) {
>     >  fail("Can't mount tmpfs");
>     >  return 1;
>     > @@ -31,6 +43,16 @@ int main(int argc, char **argv)
>     >  test_daemon();
>     >  test_waitsig();
>     > 
>     > + if (umount(dirname)) {
>     > + fail("Can't umount");
>     > + return 1;
>     > + }
>     > +
>     > + if (access(testfile, F_OK) < 0) {
>     > + fail("Can't access testfile");
>     > + return 1;
>     > + }
>     > +
>     >  pass();
>     >  return 0;
>     >  }
>     > diff --git a/test/zdtm/static/tempfs_overmounted.desc b/test/zdtm/static/
>     tempfs_overmounted.desc
>     > index 0d8b7f2b4..7657ba45c 100644
>     > --- a/test/zdtm/static/tempfs_overmounted.desc
>     > +++ b/test/zdtm/static/tempfs_overmounted.desc
>     > @@ -1 +1 @@
>     > -{'flavor': 'ns uns', 'flags': 'suid crfail'}
>     > +{'flavor': 'ns uns', 'flags': 'suid'}
>     > --
>     > 2.13.6
>     >
> 
-------------- next part --------------
diff --git a/test/zdtm/static/tempfs_overmounted.c b/test/zdtm/static/tempfs_overmounted.c
index 56c3d2ed8..29eca00f4 100644
--- a/test/zdtm/static/tempfs_overmounted.c
+++ b/test/zdtm/static/tempfs_overmounted.c
@@ -19,11 +19,38 @@ int main(int argc, char **argv)
 	test_init(argc, argv);
 
 	mkdir(dirname, 0700);
-	if (mount("none", dirname, "tmpfs", 0, "") < 0) {
+	if (chdir(dirname)) {
+		pr_perror("chdir");
+		return 1;
+	}
+
+	mkdir("a", 0777);
+	mkdir("a/b", 0777);
+
+	mount(NULL, "/", NULL, MS_PRIVATE, "");
+	if (mount("none", "a/b", "tmpfs", 0, "") < 0) {
+		fail("Can't mount tmpfs");
+		return 1;
+	}
+	if (mount("none", "a/b", "tmpfs", 0, "") < 0) {
+		fail("Can't mount tmpfs");
+		return 1;
+	}
+	mkdir("a/b/c", 0777);
+	if (mount("none", "a/b/c", "tmpfs", 0, "") < 0) {
 		fail("Can't mount tmpfs");
 		return 1;
 	}
-	if (mount("none", dirname, "tmpfs", 0, "") < 0) {
+	if (mount("none", "a", "tmpfs", 0, "") < 0) {
+		fail("Can't mount tmpfs");
+		return 1;
+	}
+	if (mount("none", "a", "tmpfs", 0, "") < 0) {
+		fail("Can't mount tmpfs");
+		return 1;
+	}
+	mkdir("a/b", 0777);
+	if (mount("none", "a/b", "tmpfs", 0, "") < 0) {
 		fail("Can't mount tmpfs");
 		return 1;
 	}
@@ -31,6 +58,11 @@ int main(int argc, char **argv)
 	test_daemon();
 	test_waitsig();
 
+	if (umount("a/b") || umount("a") || umount("a") || umount("a/b/c") || umount("a/b") || umount("a/b")) {
+		pr_err("umount");
+		return 1;
+	}
+
 	pass();
 	return 0;
 }


More information about the CRIU mailing list