Re: [PATCH v4 27/30] fs: Add iput() cleanup helper

From
Jann Horn <jannh@google.com>
Date
2025-01-13 14:00:59
Also in
lkml
Reply to
Mickaël Salaün, 2025-01-08
On Wed, Jan 8, 2025 at 4:44 PM Mickaël Salaün [off-list ref] wrote:
Add a simple scope-based helper to put an inode reference, similar to
the fput() helper.
Cleaning up inode references with scope-based cleanup seems dangerous
to me because, unlike most resources, holding a reference to an inode
beyond the lifetime of the associated superblock can actually cause
memory corruption; and scope-based cleanup is designed based on the
idea that the order and precise location of dropping a reference don't
matter so much.

So I would prefer to either not do this, or at least have some big
warning comment about usage requirements of scope-based inode
references.
Thread (58 messages) 58 messages, 5 authors, last reply 2025-01-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help