Skip to content

Commit

Permalink
cachefiles: Trace active-mark failure
Browse files Browse the repository at this point in the history
Add a tracepoint to log failure to apply an active mark to a file in
addition to tracing successfully setting and unsetting the mark.

Also include the backing file inode number in the message logged to dmesg.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
cc: linux-cachefs@redhat.com
Link: https://lore.kernel.org/r/164251404666.3435901.17331742792401482190.stgit@warthog.procyon.org.uk/ # v1
  • Loading branch information
David Howells committed Jan 21, 2022
1 parent 8c39b8b commit b64a331
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/cachefiles/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ static bool __cachefiles_mark_inode_in_use(struct cachefiles_object *object,
trace_cachefiles_mark_active(object, inode);
can_use = true;
} else {
pr_notice("cachefiles: Inode already in use: %pd\n", dentry);
trace_cachefiles_mark_failed(object, inode);
pr_notice("cachefiles: Inode already in use: %pd (B=%lx)\n",
dentry, inode->i_ino);
}

return can_use;
Expand Down
21 changes: 21 additions & 0 deletions include/trace/events/cachefiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,27 @@ TRACE_EVENT(cachefiles_mark_active,
__entry->obj, __entry->inode)
);

TRACE_EVENT(cachefiles_mark_failed,
TP_PROTO(struct cachefiles_object *obj,
struct inode *inode),

TP_ARGS(obj, inode),

/* Note that obj may be NULL */
TP_STRUCT__entry(
__field(unsigned int, obj )
__field(ino_t, inode )
),

TP_fast_assign(
__entry->obj = obj ? obj->debug_id : 0;
__entry->inode = inode->i_ino;
),

TP_printk("o=%08x B=%lx",
__entry->obj, __entry->inode)
);

TRACE_EVENT(cachefiles_mark_inactive,
TP_PROTO(struct cachefiles_object *obj,
struct inode *inode),
Expand Down

0 comments on commit b64a331

Please sign in to comment.