diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-18 17:54:43 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-10-14 14:16:56 -0700 |
commit | 9678c9e283f964c7b8dddd1c3933b7f01dc8701e (patch) | |
tree | 9311583e31d0cedb1b0b9869532d97a741261c08 /fs/xfs/scrub/trace.h | |
parent | 13e77f6373b2f8748358b3836000e7acb35c6bcf (diff) |
xfs: ensure dentry consistency when the orphanage adopts a filerepair-orphanage_2022-10-14
When the orphanage adopts a file, that file becomes a child of the
orphanage. The dentry cache may have entries for the orphanage
directory and the name we've chosen, so (1) make sure we abort if the
dcache has a positive entry because something's not right; and (2)
invalidate and purge negative dentries if the adoption goes through.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/trace.h')
-rw-r--r-- | fs/xfs/scrub/trace.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h index 8d5067b4e3d9..f86a287a3158 100644 --- a/fs/xfs/scrub/trace.h +++ b/fs/xfs/scrub/trace.h @@ -2534,6 +2534,38 @@ TRACE_EVENT(xrep_nlinks_set_record, __entry->children) ); +DECLARE_EVENT_CLASS(xrep_dentry_class, + TP_PROTO(struct xfs_mount *mp, const struct dentry *dentry), + TP_ARGS(mp, dentry), + TP_STRUCT__entry( + __field(dev_t, dev) + __field(unsigned int, type) + __field(unsigned long, ino) + __field(bool, positive) + __field(bool, has_parent) + ), + TP_fast_assign( + __entry->dev = mp->m_super->s_dev; + __entry->type = __d_entry_type(dentry); + __entry->positive = d_is_positive(dentry); + __entry->has_parent = dentry->d_parent != NULL; + __entry->ino = d_inode(dentry) ? d_inode(dentry)->i_ino : 0; + ), + TP_printk("dev %d:%d type 0x%x positive? %d parent? %d ino 0x%lx", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->type, + __entry->positive, + __entry->has_parent, + __entry->ino) +); +#define DEFINE_REPAIR_DENTRY_EVENT(name) \ +DEFINE_EVENT(xrep_dentry_class, name, \ + TP_PROTO(struct xfs_mount *mp, const struct dentry *dentry), \ + TP_ARGS(mp, dentry)) +DEFINE_REPAIR_DENTRY_EVENT(xrep_orphanage_check_child); +DEFINE_REPAIR_DENTRY_EVENT(xrep_orphanage_check_dentry); +DEFINE_REPAIR_DENTRY_EVENT(xrep_orphanage_zap_child); + #endif /* IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) */ |