From 2af6f47c8bd07c938f6164c38b93441f72145fd2 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 18 Jun 2024 12:50:55 -0700 Subject: [PATCH] Fix bad error exit path in unlink Unlink looks up the entry items for the name it is removing because we no longer store the extra key material in dentries. If this lookup fails it will use an error path which release a transaction which wasn't held. Thankfully this error path is unlikely (corruption or systemic errors like eio or enomem) so we haven't hit this in practice. Signed-off-by: Zach Brown --- kmod/src/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 357d33c6..4227457f 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -931,7 +931,7 @@ static int scoutfs_unlink(struct inode *dir, struct dentry *dentry) ret = lookup_dirent(sb, scoutfs_ino(dir), dentry->d_name.name, dentry->d_name.len, hash, &dent, dir_lock); if (ret < 0) - goto out; + goto unlock; if (should_orphan(inode)) { ret = scoutfs_lock_orphan(sb, SCOUTFS_LOCK_WRITE_ONLY, 0, scoutfs_ino(inode),