Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20241216204124.3752367-17-dhowells@redhat.com
cc: Jeff Layton <jlayton@kernel.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

David Howells and committed by
Christian Brauner
229105e5 bcb33f79

+18 -4
+8 -1
fs/cachefiles/xattr.c
··· 77 77 trace_cachefiles_vfs_error(object, file_inode(file), ret, 78 78 cachefiles_trace_setxattr_error); 79 79 trace_cachefiles_coherency(object, file_inode(file)->i_ino, 80 + be64_to_cpup((__be64 *)buf->data), 80 81 buf->content, 81 82 cachefiles_coherency_set_fail); 82 83 if (ret != -ENOMEM) ··· 86 85 "Failed to set xattr with error %d", ret); 87 86 } else { 88 87 trace_cachefiles_coherency(object, file_inode(file)->i_ino, 88 + be64_to_cpup((__be64 *)buf->data), 89 89 buf->content, 90 90 cachefiles_coherency_set_ok); 91 91 } ··· 128 126 object, 129 127 "Failed to read aux with error %zd", xlen); 130 128 why = cachefiles_coherency_check_xattr; 131 - } else if (buf->type != CACHEFILES_COOKIE_TYPE_DATA) { 129 + goto out; 130 + } 131 + 132 + if (buf->type != CACHEFILES_COOKIE_TYPE_DATA) { 132 133 why = cachefiles_coherency_check_type; 133 134 } else if (memcmp(buf->data, p, len) != 0) { 134 135 why = cachefiles_coherency_check_aux; ··· 146 141 ret = 0; 147 142 } 148 143 144 + out: 149 145 trace_cachefiles_coherency(object, file_inode(file)->i_ino, 146 + be64_to_cpup((__be64 *)buf->data), 150 147 buf->content, why); 151 148 kfree(buf); 152 149 return ret;
+10 -3
include/trace/events/cachefiles.h
··· 380 380 TRACE_EVENT(cachefiles_coherency, 381 381 TP_PROTO(struct cachefiles_object *obj, 382 382 ino_t ino, 383 + u64 disk_aux, 383 384 enum cachefiles_content content, 384 385 enum cachefiles_coherency_trace why), 385 386 386 - TP_ARGS(obj, ino, content, why), 387 + TP_ARGS(obj, ino, disk_aux, content, why), 387 388 388 389 /* Note that obj may be NULL */ 389 390 TP_STRUCT__entry( ··· 392 391 __field(enum cachefiles_coherency_trace, why) 393 392 __field(enum cachefiles_content, content) 394 393 __field(u64, ino) 394 + __field(u64, aux) 395 + __field(u64, disk_aux) 395 396 ), 396 397 397 398 TP_fast_assign( ··· 401 398 __entry->why = why; 402 399 __entry->content = content; 403 400 __entry->ino = ino; 401 + __entry->aux = be64_to_cpup((__be64 *)obj->cookie->inline_aux); 402 + __entry->disk_aux = disk_aux; 404 403 ), 405 404 406 - TP_printk("o=%08x %s B=%llx c=%u", 405 + TP_printk("o=%08x %s B=%llx c=%u aux=%llx dsk=%llx", 407 406 __entry->obj, 408 407 __print_symbolic(__entry->why, cachefiles_coherency_traces), 409 408 __entry->ino, 410 - __entry->content) 409 + __entry->content, 410 + __entry->aux, 411 + __entry->disk_aux) 411 412 ); 412 413 413 414 TRACE_EVENT(cachefiles_vol_coherency,