From patchwork Mon Dec 16 20:41:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13910341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AD87E7717F for ; Mon, 16 Dec 2024 20:43:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E20686B00D6; Mon, 16 Dec 2024 15:43:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DCEF96B00D8; Mon, 16 Dec 2024 15:43:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C488A6B00D9; Mon, 16 Dec 2024 15:43:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9FDFE6B00D6 for ; Mon, 16 Dec 2024 15:43:45 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 56288C0FB6 for ; Mon, 16 Dec 2024 20:43:45 +0000 (UTC) X-FDA: 82901997528.24.DE3B485 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf30.hostedemail.com (Postfix) with ESMTP id D67F280009 for ; Mon, 16 Dec 2024 20:42:46 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NSam6q7v; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734381801; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=E1QZn15v/KOrpymQ+ncs3oOJnWUIUbAVuPqLqJN1nJs=; b=nHNMEwq3ULTDaXa7HvdUg4Wh85KRqdibWzEDvXdZeJIQ5Kg+unzW4yl+DnlnHTGu0o0q0p oYz7bx1oGcrYZvW7E9sJQP+3JNdpx5iFcR/HESCBiSZKH9YlYU7oSpbm+pzNF42bOsBWf1 plUVcrC+xyYu5obEJWV/z5r/n6N4sZs= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NSam6q7v; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734381801; a=rsa-sha256; cv=none; b=Ah8afN4anOXjOpKulhoEaYIzZEilB6akaeAWsYgkgbTj1WuwrVIbsNQJzaLItNq7sIE+Zn 4J8QMcIR4HQzKFzDPLOE72RmpTsJ68S1clJYnPRs22kDpgA+OnNVGWfBEKcPLTq6f5UdHk n+k6epYVD6APOr0507gwbO5HuWI3VBg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734381823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E1QZn15v/KOrpymQ+ncs3oOJnWUIUbAVuPqLqJN1nJs=; b=NSam6q7v+k2/wUrQ2JWtLKRujOwS20FEgCSIlMNJKGUdOgnckXPR5svmXta1MmEWGTuIAc DMzD5sRt8sv+Bwygl0AII+Z6Pgd3oNVtBPHDGM0FXinOudIamJxdbB5+Ib+xfm1W6wYLTX C/QcmCUCmgsqvWdtPO7T9TZgnzSa0gI= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-249-pvJkCek_NMCX9YjaoDHTsQ-1; Mon, 16 Dec 2024 15:43:38 -0500 X-MC-Unique: pvJkCek_NMCX9YjaoDHTsQ-1 X-Mimecast-MFC-AGG-ID: pvJkCek_NMCX9YjaoDHTsQ Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 10C1B195608C; Mon, 16 Dec 2024 20:43:34 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.48]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8CAFD19560AD; Mon, 16 Dec 2024 20:43:28 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Matthew Wilcox Cc: David Howells , Jeff Layton , Gao Xiang , Dominique Martinet , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 16/32] cachefiles: Add auxiliary data trace Date: Mon, 16 Dec 2024 20:41:06 +0000 Message-ID: <20241216204124.3752367-17-dhowells@redhat.com> In-Reply-To: <20241216204124.3752367-1-dhowells@redhat.com> References: <20241216204124.3752367-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Rspamd-Queue-Id: D67F280009 X-Rspamd-Server: rspam12 X-Stat-Signature: 17joxfehnt8qzox4hem8boh5fnz7w3jd X-Rspam-User: X-HE-Tag: 1734381766-179140 X-HE-Meta: U2FsdGVkX1+sIsh2GG7VM6YfOJ15Epvz+hQj13DUO7vSFYfVthUu7TE1RPh+nBSWmPHtL8az1rz4NDgcmrH/ZKk6rxcZDKHBM0M2rkTlfNxdw9zozp2aNzUrtvgQYtx5GVOV1hQKJj3+q/8RzX4asbL76R0vbs1y+Plp0FCmsF3MUAggh1u6/m5rPL+qCRDMwC6Ur+b1pdDCXuLCHwuJR2YCe4yizAaHmx21BMafJ4M+V/7ah0Mk5QiVbmPLcGeLXSuCPdAGAoKK+43E6rWron7YC0nQBswsM/4X97Rd2EEFN90mskB+LXz+UQE3iIx7wxxnoXy4/FbY0w6z7FlnZTs9yPbHiACIcwK2mmaoQURau3kYh1r7CzO6VZAcvhcBk+B+o0G8ajsF51Bx4x8ysPqrt6ModMHdIBHq1phaRmfwPaEMXyscS/dkHg3K9K4sWnGBDa6Ir19SL7iESs37zStFm/I/kUJVcO00vNXSK7WayOKJlGkbeyIYKzlrhCnheHVZjOcRXDXiBg0seZZhP51y9ezYRVnFyBxx/ScR2rCUt6Z/ijHk79NXcCcaAXXFOkFE1+y69WEcRjlVvei0JuvvTwoH8DUNKrZfLUpiCMLX4EK2MmDNz/EqJoRzeTOHFjGGcpxjbHZP3lVXqRS4elQo+eXkJAiSMSfGcC+kPOWJEHri8KEPu9VzqD9O3ryylW1o90aIqw71SpL+WqkvZmADJWN4L1Ewjcr5kx1TL54s5jIGSIqwIDefFQu2Ecw6hZaM2iu3qx+ttJUH5QNxT9B488EOFGhkkoaYPfXhj7e8k7hCk/9vnhkwDKOyegvKE1kE23c7YHm8qNbg5E15K2ri7NLDF55juO7YgnppXuSS8J1s5s/cS0wPLr/FVFbOyq3n3QeuRUFvovI/5EQUUvNXM9AAF2aaU2aVF8m35OVr4Gdb2v0N+EUYLuzmhO1ejvzTMjEi3DNKOIpGUc+ kM3zLTQy hgRfUk8Q+KFAtQQ8f3nIoXXWuScsZZDJ/EO2kPu6+9jAZDC5ZO7ArjRZtVGNmT8YEoismSWHlR9R+nPlexG/QcnB0C85xioEnkOkjRg8Vv7vfnwBpXuJslHIS1OM7T0yrbz9qdCcEF7oxkq7CNjM8lsz34pqlyMmdgoSYe1fmDoAtd8tU5ex6IKFyqiQCCpDMCoCbynnTOasM6qVq7Gsk4YdZU55OpIcLo3w7kQ8Vl4FDOxWGxwTCzlf289r0p+UbSVHasRKNfcOdlHAozFQKWqOHwfRNh7mJDTU9N9SUpUkkes1VAZVRBGQhdMIUlbHcPF8REA6xJ0+df1KB4EOd8Dtl8X1McCITCMWu X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 cc: Jeff Layton cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/cachefiles/xattr.c | 9 ++++++++- include/trace/events/cachefiles.h | 13 ++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index 7c6f260a3be5..52383b1d0ba6 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c @@ -77,6 +77,7 @@ int cachefiles_set_object_xattr(struct cachefiles_object *object) trace_cachefiles_vfs_error(object, file_inode(file), ret, cachefiles_trace_setxattr_error); trace_cachefiles_coherency(object, file_inode(file)->i_ino, + be64_to_cpup((__be64 *)buf->data), buf->content, cachefiles_coherency_set_fail); if (ret != -ENOMEM) @@ -85,6 +86,7 @@ int cachefiles_set_object_xattr(struct cachefiles_object *object) "Failed to set xattr with error %d", ret); } else { trace_cachefiles_coherency(object, file_inode(file)->i_ino, + be64_to_cpup((__be64 *)buf->data), buf->content, cachefiles_coherency_set_ok); } @@ -126,7 +128,10 @@ int cachefiles_check_auxdata(struct cachefiles_object *object, struct file *file object, "Failed to read aux with error %zd", xlen); why = cachefiles_coherency_check_xattr; - } else if (buf->type != CACHEFILES_COOKIE_TYPE_DATA) { + goto out; + } + + if (buf->type != CACHEFILES_COOKIE_TYPE_DATA) { why = cachefiles_coherency_check_type; } else if (memcmp(buf->data, p, len) != 0) { why = cachefiles_coherency_check_aux; @@ -141,7 +146,9 @@ int cachefiles_check_auxdata(struct cachefiles_object *object, struct file *file ret = 0; } +out: trace_cachefiles_coherency(object, file_inode(file)->i_ino, + be64_to_cpup((__be64 *)buf->data), buf->content, why); kfree(buf); return ret; diff --git a/include/trace/events/cachefiles.h b/include/trace/events/cachefiles.h index 74114c261bcd..a743b2a35ea7 100644 --- a/include/trace/events/cachefiles.h +++ b/include/trace/events/cachefiles.h @@ -380,10 +380,11 @@ TRACE_EVENT(cachefiles_rename, TRACE_EVENT(cachefiles_coherency, TP_PROTO(struct cachefiles_object *obj, ino_t ino, + u64 disk_aux, enum cachefiles_content content, enum cachefiles_coherency_trace why), - TP_ARGS(obj, ino, content, why), + TP_ARGS(obj, ino, disk_aux, content, why), /* Note that obj may be NULL */ TP_STRUCT__entry( @@ -391,6 +392,8 @@ TRACE_EVENT(cachefiles_coherency, __field(enum cachefiles_coherency_trace, why) __field(enum cachefiles_content, content) __field(u64, ino) + __field(u64, aux) + __field(u64, disk_aux) ), TP_fast_assign( @@ -398,13 +401,17 @@ TRACE_EVENT(cachefiles_coherency, __entry->why = why; __entry->content = content; __entry->ino = ino; + __entry->aux = be64_to_cpup((__be64 *)obj->cookie->inline_aux); + __entry->disk_aux = disk_aux; ), - TP_printk("o=%08x %s B=%llx c=%u", + TP_printk("o=%08x %s B=%llx c=%u aux=%llx dsk=%llx", __entry->obj, __print_symbolic(__entry->why, cachefiles_coherency_traces), __entry->ino, - __entry->content) + __entry->content, + __entry->aux, + __entry->disk_aux) ); TRACE_EVENT(cachefiles_vol_coherency,