From 83ae5cc252ab51acdbc184c85ecd6a28fa268fa2 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 30 Apr 2020 15:01:39 +0200 Subject: [PATCH 1/7] tests/unlink.sh: make sure directories are empty Signed-off-by: Giuseppe Scrivano --- tests/unlink.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unlink.sh b/tests/unlink.sh index a963c07..77d4242 100755 --- a/tests/unlink.sh +++ b/tests/unlink.sh @@ -1,5 +1,7 @@ #!/bin/sh +rm -rf lower upper workdir merged + mkdir lower upper workdir merged touch lower/a From 33a3a7970e3394bf9ec67f967c021d88f6bfe01b Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 30 Apr 2020 11:01:12 +0200 Subject: [PATCH 2/7] main: avoid double free on cleanup the cleanup_node_init label already takes care of it. Signed-off-by: Giuseppe Scrivano --- main.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index 0f1ff13..f14552f 100644 --- a/main.c +++ b/main.c @@ -1097,19 +1097,13 @@ make_whiteout_node (const char *path, const char *name) new_name = strdup (name); if (new_name == NULL) - { - free (ret); - return NULL; - } + return NULL; + node_set_name (ret, new_name); ret->path = strdup (path); if (ret->path == NULL) - { - free (new_name); - free (ret); - return NULL; - } + return NULL; ret->whiteout = 1; ret->ino = &dummy_ino; From b947555f87aa8da9fd94293cec598e05856ce2e0 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 30 Apr 2020 11:03:57 +0200 Subject: [PATCH 3/7] main: remove superflous check pnode cannot be NULL. Signed-off-by: Giuseppe Scrivano --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index f14552f..e50e6af 100644 --- a/main.c +++ b/main.c @@ -1760,7 +1760,7 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name) char whpath[PATH_MAX]; const char *wh_name; - if (pnode && pnode->last_layer == it) + if (pnode->last_layer == it) stop_lookup = true; strconcat3 (path, PATH_MAX, pnode->path, "/", name); From cb934ef8718224274506a0509f94aee67e74263a Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 30 Apr 2020 11:10:41 +0200 Subject: [PATCH 4/7] main: delete dead code Signed-off-by: Giuseppe Scrivano --- main.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/main.c b/main.c index e50e6af..a6486f9 100644 --- a/main.c +++ b/main.c @@ -1219,7 +1219,6 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c for (it = layer; it; it = it->next) { ssize_t s; - bool stat_only = false; cleanup_free char *val = NULL; cleanup_free char *origin = NULL; cleanup_close int fd = -1; @@ -1269,12 +1268,6 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c ret->last_layer = it; } - if (stat_only) - { - has_origin = false; - goto no_fd; - } - s = safe_read_xattr (&val, fd, PRIVILEGED_ORIGIN_XATTR, PATH_MAX); if (s > 0) { From 9b687001bba8a39fc602f68c7ad0d49a0bd5c262 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 30 Apr 2020 11:14:00 +0200 Subject: [PATCH 5/7] main: fix signature for ovl_ioctl Signed-off-by: Giuseppe Scrivano --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index a6486f9..c3b391d 100644 --- a/main.c +++ b/main.c @@ -4694,7 +4694,7 @@ direct_ioctl (struct ovl_layer *l, int fd, int cmd, unsigned long *r) } static void -ovl_ioctl (fuse_req_t req, fuse_ino_t ino, unsigned int cmd, void *arg, +ovl_ioctl (fuse_req_t req, fuse_ino_t ino, int cmd, void *arg, struct fuse_file_info *fi, unsigned int flags, const void *in_buf, size_t in_bufsz, size_t out_bufsz) { From f6262ed778f6f42b5555bb6bb9d94fa1d75f5a57 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 30 Apr 2020 11:09:09 +0200 Subject: [PATCH 6/7] main: fix copy loop fix potential infinite loop on a short read. Signed-off-by: Giuseppe Scrivano --- main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index c3b391d..b0cfdd6 100644 --- a/main.c +++ b/main.c @@ -2557,12 +2557,14 @@ copy_fd_to_fd (int sfd, int dfd, char *buf, size_t buf_size) break; written = 0; - { - ret = TEMP_FAILURE_RETRY (write (dfd, buf + written, nread)); - if (ret < 0) - return ret; - nread -= ret; - } + do + { + ret = TEMP_FAILURE_RETRY (write (dfd, buf + written, nread)); + if (ret < 0) + return ret; + nread -= ret; + written += ret; + } while (nread); } return 0; From 77a4493db5390701755490ed3bddea79fc1c2046 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 30 Apr 2020 15:19:02 +0200 Subject: [PATCH 7/7] travis: run tests sequentially Signed-off-by: Giuseppe Scrivano --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a774971..5048eaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,6 @@ script: - (cd /unionmount-testsuite; sudo FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT=1 unshare -m ./run --ov --fuse=fuse-overlayfs --xdev) || travis_terminate 1; - sudo tests/fedora-installs.sh || travis_terminate 1; - sudo tests/unlink.sh || travis_terminate 1; - - (cd $GOPATH/src/github.com/containers/storage/tests; sudo STORAGE_OPTION=overlay.mount_program=/sbin/fuse-overlayfs STORAGE_DRIVER=overlay unshare -m ./test_runner.bash) || travis_terminate 1; - - (cd $GOPATH/src/github.com/containers/storage/tests; sudo FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT=1 STORAGE_OPTION=overlay.mount_program=/sbin/fuse-overlayfs STORAGE_DRIVER=overlay unshare -m ./test_runner.bash) || travis_terminate 1; + - (cd $GOPATH/src/github.com/containers/storage/tests; sudo JOBS=1 STORAGE_OPTION=overlay.mount_program=/sbin/fuse-overlayfs STORAGE_DRIVER=overlay unshare -m ./test_runner.bash) || travis_terminate 1; + - (cd $GOPATH/src/github.com/containers/storage/tests; sudo JOBS=1 FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT=1 STORAGE_OPTION=overlay.mount_program=/sbin/fuse-overlayfs STORAGE_DRIVER=overlay unshare -m ./test_runner.bash) || travis_terminate 1; - docker run --rm -v $(pwd):/fuse-overlayfs alpine-build sh -c 'cd /fuse-overlayfs; ./autogen.sh && ./configure && make clean && make'