* [PATCH] ecryptfs: release inode on error path in ecryptfs_lookup_interpose
@ 2026-11-24 19:54 Alexander Mikhalitsyn
0 siblings, 0 replies; only message in thread
From: Alexander Mikhalitsyn @ 2026-11-24 19:54 UTC (permalink / raw)
To: code
Cc: brauner, ecryptfs, linux-fsdevel, Alexander Mikhalitsyn, Jan Kara,
Seth Forshee, Paul Moore, linux-kernel
Currently, when ecryptfs_i_size_read() fails we only do make_bad_inode()
which only removes the inode from a hash. So it's not getting released
and on umount we get "VFS: Busy inodes after unmount of ecryptfs" (see below).
Let's fix it by using iget_failed() when inode is I_NEW and iput() when it's not.
This was accidentally found while working on SB_I_PSEUDO fix.
------------[ cut here ]------------
VFS: Busy inodes after unmount of ecryptfs (ecryptfs)
WARNING: fs/super.c:731 at generic_shutdown_super+0x117/0x1a0, CPU#11: umount/402
Modules linked in:
CPU: 11 UID: 0 PID: 402 Comm: umount Not tainted 7.4.0-rc1-virtme #9 PREEMPT(lazy)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:generic_shutdown_super+0x125/0x1a0
Code: 5d 5d c3 cc cc cc cc e8 19 d0 f3 ff 48 8b bb 18 01 00 00 eb d7 48 8d 3d a9 93 d1 01 48 8b 43 50 48 8d b3 d8 03 00 00 48 8b 10 <67> 48 0f b9 3a 4c 8d ab 40 05 00 00 4c 89 ef e8 17 6c b0 00 48 8b
RSP: 0018:ffffccc0406bbcf8 EFLAGS: 00010283
RAX: ffffffff87d54a20 RBX: ffff8a7bc2358800 RCX: 00000000000000b5
RDX: ffffffff873e7853 RSI: ffff8a7bc2358bd8 RDI: ffffffff87e52550
RBP: ffffccc0406bbd10 R08: ffff8a7bc235d408 R09: fffff12a00000000
R10: ffffccc0406bbcf0 R11: ffffffff87d209d8 R12: ffff8a7bc2358d48
R13: ffff8a7bc2388824 R14: 0000000000000000 R15: 0000000000000000
FS: 00007fd846e02840(0000) GS:ffff8a7c76af9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd84716e8e0 CR3: 00000000037d8000 CR4: 0000000000350eb0
Call Trace:
<TASK>
kill_anon_super+0x1c/0x80
ecryptfs_kill_block_super+0x1a/0x50
deactivate_locked_super+0x39/0xc0
deactivate_super+0x47/0x60
cleanup_mnt+0x3b/0x80
__cleanup_mnt+0x16/0x20
task_work_run+0x64/0x90
exit_to_user_mode_loop+0x177/0x570
do_syscall_64+0x352/0x410
? up_read+0x1f/0xe0
? schedule+0x27/0xb0
? schedule+0x27/0xb0
? schedule+0x27/0xb0
? trace_preempt_on+0x28/0x80
? schedule+0x38/0xb0
? preempt_count_sub+0x4d/0x70
? irqentry_exit+0x2e1/0x700
? exc_page_fault+0x8d/0x170
? do_syscall_64+0x33/0x410
entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7fd84705c1d7
Code: 0d 00 f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 8b 15 09 3c 0d 00 f7 d8 64 89 02 b8
RSP: 002b:00007ffd3839fae8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 000055b7f819dbf8 RCX: 00007fd84705c1d7
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000055b7f819df30
RBP: 0000000000000000 R08: 00007ffd3839e8d0 R09: 00000000ffffffff
R10: 0000000000000103 R11: 0000000000000246 R12: 00007fd8471ba26c
R13: 000055b7f819df30 R14: 0000000000000000 R15: 000055b7f819daf0
</TASK>
---[ end trace 0000000000000000 ]---
Fixes: 3b06b3ebf441 ("eCryptfs: Fix new inode race condition")
Signed-off-by: Alexander Mikhalitsyn <alex@amutable.com>
---
fs/ecryptfs/inode.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 48e520960d66..3a966348a578 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -362,7 +362,10 @@ static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry,
if (S_ISREG(inode->i_mode)) {
rc = ecryptfs_i_size_read(dentry, inode);
if (rc) {
- make_bad_inode(inode);
+ if (inode_state_read_once(inode) & I_NEW)
+ iget_failed(inode);
+ else
+ iput(inode);
return ERR_PTR(rc);
}
}
--
2.47.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-24 19:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 19:54 [PATCH] ecryptfs: release inode on error path in ecryptfs_lookup_interpose Alexander Mikhalitsyn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox