Skip to content

Commit 229105e

Browse files
dhowellsbrauner
authored andcommitted
cachefiles: Add auxiliary data trace
Add a display of the first 8 bytes of the downloaded auxiliary data and of the on-disk stored auxiliary data as these are used in coherency management. In the case of afs, this holds the data version number. Signed-off-by: David Howells <[email protected]> Link: https://lore.kernel.org/r/[email protected] cc: Jeff Layton <[email protected]> cc: [email protected] cc: [email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent bcb33f7 commit 229105e

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

fs/cachefiles/xattr.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ int cachefiles_set_object_xattr(struct cachefiles_object *object)
7777
trace_cachefiles_vfs_error(object, file_inode(file), ret,
7878
cachefiles_trace_setxattr_error);
7979
trace_cachefiles_coherency(object, file_inode(file)->i_ino,
80+
be64_to_cpup((__be64 *)buf->data),
8081
buf->content,
8182
cachefiles_coherency_set_fail);
8283
if (ret != -ENOMEM)
@@ -85,6 +86,7 @@ int cachefiles_set_object_xattr(struct cachefiles_object *object)
8586
"Failed to set xattr with error %d", ret);
8687
} else {
8788
trace_cachefiles_coherency(object, file_inode(file)->i_ino,
89+
be64_to_cpup((__be64 *)buf->data),
8890
buf->content,
8991
cachefiles_coherency_set_ok);
9092
}
@@ -126,7 +128,10 @@ int cachefiles_check_auxdata(struct cachefiles_object *object, struct file *file
126128
object,
127129
"Failed to read aux with error %zd", xlen);
128130
why = cachefiles_coherency_check_xattr;
129-
} else if (buf->type != CACHEFILES_COOKIE_TYPE_DATA) {
131+
goto out;
132+
}
133+
134+
if (buf->type != CACHEFILES_COOKIE_TYPE_DATA) {
130135
why = cachefiles_coherency_check_type;
131136
} else if (memcmp(buf->data, p, len) != 0) {
132137
why = cachefiles_coherency_check_aux;
@@ -141,7 +146,9 @@ int cachefiles_check_auxdata(struct cachefiles_object *object, struct file *file
141146
ret = 0;
142147
}
143148

149+
out:
144150
trace_cachefiles_coherency(object, file_inode(file)->i_ino,
151+
be64_to_cpup((__be64 *)buf->data),
145152
buf->content, why);
146153
kfree(buf);
147154
return ret;

include/trace/events/cachefiles.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,31 +380,38 @@ TRACE_EVENT(cachefiles_rename,
380380
TRACE_EVENT(cachefiles_coherency,
381381
TP_PROTO(struct cachefiles_object *obj,
382382
ino_t ino,
383+
u64 disk_aux,
383384
enum cachefiles_content content,
384385
enum cachefiles_coherency_trace why),
385386

386-
TP_ARGS(obj, ino, content, why),
387+
TP_ARGS(obj, ino, disk_aux, content, why),
387388

388389
/* Note that obj may be NULL */
389390
TP_STRUCT__entry(
390391
__field(unsigned int, obj)
391392
__field(enum cachefiles_coherency_trace, why)
392393
__field(enum cachefiles_content, content)
393394
__field(u64, ino)
395+
__field(u64, aux)
396+
__field(u64, disk_aux)
394397
),
395398

396399
TP_fast_assign(
397400
__entry->obj = obj->debug_id;
398401
__entry->why = why;
399402
__entry->content = content;
400403
__entry->ino = ino;
404+
__entry->aux = be64_to_cpup((__be64 *)obj->cookie->inline_aux);
405+
__entry->disk_aux = disk_aux;
401406
),
402407

403-
TP_printk("o=%08x %s B=%llx c=%u",
408+
TP_printk("o=%08x %s B=%llx c=%u aux=%llx dsk=%llx",
404409
__entry->obj,
405410
__print_symbolic(__entry->why, cachefiles_coherency_traces),
406411
__entry->ino,
407-
__entry->content)
412+
__entry->content,
413+
__entry->aux,
414+
__entry->disk_aux)
408415
);
409416

410417
TRACE_EVENT(cachefiles_vol_coherency,

0 commit comments

Comments
 (0)