public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] btrfs: trace use file_inode(file)->i_sb to calculate fs_info
@ 2026-02-19  1:49 Goldwyn Rodrigues
  2026-02-19  9:18 ` Filipe Manana
  0 siblings, 1 reply; 5+ messages in thread
From: Goldwyn Rodrigues @ 2026-02-19  1:49 UTC (permalink / raw)
  To: linux-btrfs

If overlay is used on top of btrfs, dentry->d_sb translates to overlay's
super block and fsid assignment will lead to a crash.

Use file_inode(file)->i_sb to always get btrfs_sb.

Changes since v1:
  Changed subject to include trace
  Use file_inode() to get inode pointer

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
---
 include/trace/events/btrfs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 125bdc166bfe..92118df217b4 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -770,9 +770,9 @@ TRACE_EVENT(btrfs_sync_file,
 
 	TP_fast_assign(
 		const struct dentry *dentry = file->f_path.dentry;
-		const struct inode *inode = d_inode(dentry);
+		const struct inode *inode = file_inode(file);
 
-		TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb));
+		TP_fast_assign_fsid(btrfs_sb(inode->i_sb));
 		__entry->ino		= btrfs_ino(BTRFS_I(inode));
 		__entry->parent		= btrfs_ino(BTRFS_I(d_inode(dentry->d_parent)));
 		__entry->datasync	= datasync;
-- 
2.53.0


-- 
Goldwyn

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-25 13:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19  1:49 [PATCH v2] btrfs: trace use file_inode(file)->i_sb to calculate fs_info Goldwyn Rodrigues
2026-02-19  9:18 ` Filipe Manana
2026-02-19 11:52   ` Filipe Manana
2026-02-25 13:31     ` Goldwyn Rodrigues
2026-02-25 13:46       ` Filipe Manana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox