git: 5e5baba880a2 - main - Revert "makefs: don't needlessly require directories to exist"

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 12 Jan 2023 18:26:49 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=5e5baba880a2cf070872ab538b6a3a105324b302

commit 5e5baba880a2cf070872ab538b6a3a105324b302
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-01-12 18:21:27 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-01-12 18:21:27 +0000

    Revert "makefs: don't needlessly require directories to exist"
    
    I pushed prematurely and this version is broken.
    
    This reverts commit 794154149f95d0cbc11aade166f9da919747e397.
---
 usr.sbin/makefs/zfs/fs.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/usr.sbin/makefs/zfs/fs.c b/usr.sbin/makefs/zfs/fs.c
index 7f74e300f5d7..3cf328122df8 100644
--- a/usr.sbin/makefs/zfs/fs.c
+++ b/usr.sbin/makefs/zfs/fs.c
@@ -292,16 +292,6 @@ fs_open(const fsnode *cur, struct fs_populate_arg *arg, int flags)
 	return (fd);
 }
 
-static int
-fs_open_can_fail(const fsnode *cur, struct fs_populate_arg *arg, int flags)
-{
-	char path[PATH_MAX];
-
-	fs_populate_path(cur, arg, path, sizeof(path), &fd);
-
-	return (openat(fd, path, flags));
-}
-
 static void
 fs_readlink(const fsnode *cur, struct fs_populate_arg *arg,
     char *buf, size_t bufsz)
@@ -600,12 +590,7 @@ fs_populate_dir(fsnode *cur, struct fs_populate_arg *arg)
 	 */
 	if (!SLIST_EMPTY(&arg->dirs)) {
 		fs_populate_dirent(arg, cur, dnid);
-		/*
-		 * We only need the directory fd if we're finding files in
-		 * it.  If it's just there for other directories or
-		 * files using contents= we don't need to succeed here.
-		 */
-		dirfd = fs_open_can_fail(cur, arg, O_DIRECTORY | O_RDONLY);
+		dirfd = fs_open(cur, arg, O_DIRECTORY | O_RDONLY);
 	} else {
 		arg->rootdirid = dnid;
 		dirfd = arg->rootdirfd;