git: ef184e989b54 - main - tarfs: Fix backtracking during node creation.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Mar 2023 12:20:01 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=ef184e989b548da3a0cb703f58db00921ad612c4
commit ef184e989b548da3a0cb703f58db00921ad612c4
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-03-16 11:31:14 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-03-16 11:31:22 +0000
tarfs: Fix backtracking during node creation.
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39082
---
sys/fs/tarfs/tarfs_vfsops.c | 5 +++++
tests/sys/fs/tarfs/mktar.c | 10 +---------
tests/sys/fs/tarfs/tarfs_test.sh | 12 ++++++++----
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/sys/fs/tarfs/tarfs_vfsops.c b/sys/fs/tarfs/tarfs_vfsops.c
index 837fc7644ac1..17d6814ba973 100644
--- a/sys/fs/tarfs/tarfs_vfsops.c
+++ b/sys/fs/tarfs/tarfs_vfsops.c
@@ -347,6 +347,11 @@ tarfs_lookup_path(struct tarfs_mount *tmp, char *name, size_t namelen,
}
tnp = parent;
parent = tnp->parent;
+ cn.cn_nameptr = tnp->name;
+ cn.cn_namelen = tnp->namelen;
+ do_lookup = true;
+ TARFS_DPF(LOOKUP, "%s: back to %.*s/\n", __func__,
+ (int)tnp->namelen, tnp->name);
name += len;
namelen -= len;
continue;
diff --git a/tests/sys/fs/tarfs/mktar.c b/tests/sys/fs/tarfs/mktar.c
index 4e7d1acc1c82..391ac9170171 100644
--- a/tests/sys/fs/tarfs/mktar.c
+++ b/tests/sys/fs/tarfs/mktar.c
@@ -41,7 +41,6 @@
#define PROGNAME "mktar"
#define SUBDIRNAME "directory"
-#define EMPTYDIRNAME "empty"
#define NORMALFILENAME "file"
#define SPARSEFILENAME "sparse_file"
#define HARDLINKNAME "hard_link"
@@ -128,11 +127,6 @@ mktar(void)
if (mkdir(SUBDIRNAME, 0755) != 0)
err(1, "%s", SUBDIRNAME);
- /* create a second subdirectory which will remain empty */
- verbose("mkdir %s", EMPTYDIRNAME);
- if (mkdir(EMPTYDIRNAME, 0755) != 0)
- err(1, "%s", EMPTYDIRNAME);
-
/* create a normal file */
verbose("creating %s", NORMALFILENAME);
mknormalfile(NORMALFILENAME, 0644);
@@ -233,7 +227,7 @@ main(int argc, char *argv[])
#if 0
"--options", "zstd:frame-per-file",
#endif
- "./" EMPTYDIRNAME "/../" NORMALFILENAME,
+ "./" SUBDIRNAME "/../" NORMALFILENAME,
"./" SPARSEFILENAME,
"./" HARDLINKNAME,
"./" SHORTLINKNAME,
@@ -262,8 +256,6 @@ main(int argc, char *argv[])
(void)unlink(HARDLINKNAME);
verbose("rm %s", SPARSEFILENAME);
(void)unlink(SPARSEFILENAME);
- verbose("rmdir %s", EMPTYDIRNAME);
- (void)rmdir(EMPTYDIRNAME);
verbose("rmdir %s", SUBDIRNAME);
(void)rmdir(SUBDIRNAME);
verbose("cd -");
diff --git a/tests/sys/fs/tarfs/tarfs_test.sh b/tests/sys/fs/tarfs/tarfs_test.sh
index d0624b79eb2d..15354aac501a 100644
--- a/tests/sys/fs/tarfs/tarfs_test.sh
+++ b/tests/sys/fs/tarfs/tarfs_test.sh
@@ -58,10 +58,14 @@ tarfs_basic_body() {
atf_check_equal "$(stat -f%d,%i "${mnt}"/sparse_file)" "$(stat -f%d,%i "${mnt}"/hard_link)"
atf_check_equal "$(stat -f%d,%i "${mnt}"/sparse_file)" "$(stat -L -f%d,%i "${mnt}"/short_link)"
atf_check_equal "$(stat -f%d,%i "${mnt}"/sparse_file)" "$(stat -L -f%d,%i "${mnt}"/long_link)"
- atf_check_equal "$(sha256 -q "${mnt}"/sparse_file)" ${sum}
- atf_check_equal "$(stat -f%p "${mnt}"/sparse_file)" 100644
- atf_check_equal "$(stat -f%l "${mnt}"/sparse_file)" 2
- atf_check_equal "$(stat -f%l "${mnt}"/hard_link)" 2
+ atf_check -o inline:"${sum}\n" sha256 -q "${mnt}"/sparse_file
+ atf_check -o inline:"2,40755\n" stat -f%l,%p "${mnt}"/directory
+ atf_check -o inline:"1,100644\n" stat -f%l,%p "${mnt}"/file
+ atf_check -o inline:"2,100644\n" stat -f%l,%p "${mnt}"/hard_link
+ atf_check -o inline:"1,120755\n" stat -f%l,%p "${mnt}"/long_link
+ atf_check -o inline:"1,120755\n" stat -f%l,%p "${mnt}"/short_link
+ atf_check -o inline:"2,100644\n" stat -f%l,%p "${mnt}"/sparse_file
+ atf_check -o inline:"3,40755\n" stat -f%l,%p "${mnt}"
}
tarfs_basic_cleanup() {
umount "${mnt}" || true