[PATCH] eventfs: Use SRCU for freeing eventfs_inodes

Mathias Krause posted 1 patch 1 year, 6 months ago
fs/tracefs/event_inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] eventfs: Use SRCU for freeing eventfs_inodes
Posted by Mathias Krause 1 year, 6 months ago
To mirror the SRCU lock held in eventfs_iterate() when iterating over
eventfs inodes, use call_srcu() to free them too.

This was accidentally(?) degraded to RCU in commit 43aa6f97c2d0
("eventfs: Get rid of dentry pointers without refcounts").

Cc: Ajay Kaher <ajay.kaher@broadcom.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Fixes: 43aa6f97c2d0 ("eventfs: Get rid of dentry pointers without refcounts")
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
---
 fs/tracefs/event_inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index a9c28a1d5dc8..01e99e98457d 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -112,7 +112,7 @@ static void release_ei(struct kref *ref)
 			entry->release(entry->name, ei->data);
 	}
 
-	call_rcu(&ei->rcu, free_ei_rcu);
+	call_srcu(&eventfs_srcu, &ei->rcu, free_ei_rcu);
 }
 
 static inline void put_ei(struct eventfs_inode *ei)
-- 
2.43.0
Re: [PATCH] eventfs: Use SRCU for freeing eventfs_inodes
Posted by Steven Rostedt 1 year, 6 months ago
On Tue, 23 Jul 2024 23:07:53 +0200
Mathias Krause <minipli@grsecurity.net> wrote:

> To mirror the SRCU lock held in eventfs_iterate() when iterating over
> eventfs inodes, use call_srcu() to free them too.
> 
> This was accidentally(?) degraded to RCU in commit 43aa6f97c2d0
> ("eventfs: Get rid of dentry pointers without refcounts").

Yeah, I missed that. Linus cleaned up the code code quite a bit, but
missed the subtleties of the RCU clean ups. I should have caught that
in my review.

Thanks for sending this.

-- Steve