From patchwork Fri Nov 8 17:32:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13868576 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 56510D64072 for ; Fri, 8 Nov 2024 17:35:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9FFB6B00A1; Fri, 8 Nov 2024 12:35:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D4E246B00BC; Fri, 8 Nov 2024 12:35:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEE176B00BE; Fri, 8 Nov 2024 12:35:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9DDB76B00A1 for ; Fri, 8 Nov 2024 12:35:06 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 445D1A010F for ; Fri, 8 Nov 2024 17:35:06 +0000 (UTC) X-FDA: 82763627058.27.10DAF2D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 6F9912002A for ; Fri, 8 Nov 2024 17:34:47 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IvDUd+bw; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731087133; 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=aZQE6Gk2pDLRsrGirLF3LOxjqtk3JDWUrBtiyK47AD0=; b=hFQMnHiTU5ip6yl/a4CQPe1PdEGWt01v9tyYepoM8eQ9S8uJ/NlYnXh7LYWfOry8NMGs6J M+2MW4RHxEKDC3VQj5L5vKdcmnbB6+Ftu8h+AbqAOcrV55I5AzHr1w0MuL/bg266QpOlOA 6cm2qd+CiX87z+1f5tnJq06f4bCrXSw= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IvDUd+bw; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731087133; a=rsa-sha256; cv=none; b=cniqGxj7Mjqfbe5dJyv/vKM3a3GJbypmwSuPzcgTNn3rq6NN80N2Z/YWrv0xIJQAJAVSW8 ERZ8btVGOjrOF9N9Gv6XtT1so4E+N7QYqkJHcYHlxAwrlUFHSKR1JjJmp1xcGGGaYGwIXK INFd/CTsuDK4dAXStxCCRL7Se+C90N0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731087303; 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=aZQE6Gk2pDLRsrGirLF3LOxjqtk3JDWUrBtiyK47AD0=; b=IvDUd+bwmnLeVETWsQKLS2Rha94zLiF0EIBqjLKwAqsXiJ7hiSPsFTYeid+arMbGZ+a+Pp xDNI4NgPdSmRv1Ex8SzZY41qn+6JDdZLWY3tfJBveG2ibZ03QJOsn+KTX7tL58Ia1yQA1D IF0hXsPZJv9Hgh95+6rxbbw1mmmiiiY= Received: from mx-prod-mc-04.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-500-mXByTJK0Mx-Oo6w3qzMSgA-1; Fri, 08 Nov 2024 12:34:58 -0500 X-MC-Unique: mXByTJK0Mx-Oo6w3qzMSgA-1 X-Mimecast-MFC-AGG-ID: mXByTJK0Mx-Oo6w3qzMSgA Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7709819560B5; Fri, 8 Nov 2024 17:34:55 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.231]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 07730300019E; Fri, 8 Nov 2024 17:34:49 +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 v4 18/33] cachefiles: Add auxiliary data trace Date: Fri, 8 Nov 2024 17:32:19 +0000 Message-ID: <20241108173236.1382366-19-dhowells@redhat.com> In-Reply-To: <20241108173236.1382366-1-dhowells@redhat.com> References: <20241108173236.1382366-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 6F9912002A X-Stat-Signature: id1755cw5n81djeundudp9wueraq17ry X-Rspam-User: X-HE-Tag: 1731087287-55837 X-HE-Meta: U2FsdGVkX1+krglJVX019DuKRtQX9tUm05fJJb52Ccz4sgC+DWnk+/FEiUTGOBE0zhkeU+dvAsuGEXRFTRnfpaHmajgqk4QgcI0N2AK/N9iCoj46YPEPUtXJEHsCNl4xGw+IrLvJUARL9pAUuOv1LiplkSAHFWIIVPl6o+S823WruWDYYfJYn1H4dslcSSruLxiXdL7R+Oq6Wr3ZhK78Kn+cuskvmD8UwsR+NVrPIX4MpkZEOkgZ/2nZFYetHHnCnp8NLCEPna4kc29nH92X3uWidWHdvRfw7GbmkufoWPc3asum/oZr8JLtovFjOxWcJ7n+YuNaiaQk8qyoDHpaXWSxsQFGMOS7QWFCKvfyIHi99oPFrqtn6ftJRdjjv6YuiJFJgYaCHkQ8vM+5vXtfDN//6ZhkGSvpkhqa3s4koRgEFPhCc/Op990lFpV2aGDgw7z+XnWMKwVq3NRCGoxoSrIeWmRuFi+MxO6VrbZ87vRF37Q1m6iCs+P8ZoqH4GowVD9mGAFPbFnrTWdxUTwXOCz7v/i/4a+L9Yts3X4BF3835FcTL7otaEDujc7TuEHq7HpKiENpUYPrywJTzeng7FdCcTVZmqHIUNtv/2T2aJCuc/sPGfrzQQUsU2h0MZ/wGo+0VMWqqd1aa0lbXNDOAKf/tjNLW8MJGfvrGCFDW1mi4QmdfNbkbXLH1JtnRX9/ILpzS/lNlsgOeHYd8dSHy966q/BuCTUGTbWHMF7B8ADTItztN8lhS49np6NJpK25O8Jx3aU2pUnlJHw+m+fc04M+739izeneogNVKtioygARYdio6JHUzkyOKa7LJ73jjE4RKPBo94hMssJaJm1gPeWCETmCCsjsW9H/QbJkrBDQtfsTDDJ33t8u1IdOJtDZSF2JDyQD29sH0rNIJwcexKtDpCx7tLB8T6x7qT76JhSMAhgs0fjlYSVxs2x5EiPQItOKTk1N4uKISbIqPS+ 9tFJ2Jcs sl1j6UrWOmzRdpYrsaoQOu2Do4+EbPZNRCG0mErLmTGYsF6YlYFL24dhYQJQoxnAYWeEBYCKF4ktwGf6yyc/WAoOOxtVyaSEER3rkYL35LQRYTf2RO8lNMTbILd+SjR8iWdxlElZEMhmC59GoMsaGMntGGiyDNBoPiroiW8EvqKWd63a3UvkYnXY05BGRrAo9CggZ46AnQ4ZqAgXAHUZmeBRcrTw5q2zqmWsejMrhluxfhC2NgTU1BFl8sbodKJu+5yfEOx0EEbx3B3YfNJrrZescZlFZL9voG3uzsXUX0XRp9vcP2+PJXfKCC68Q4RH/rNFp18vw3XG9llmnl394Yo7edZhYuzX6K8d2tuj3GvgejhiejuR97J/uOxDGeHz2OgTCIZpfOxKSNjDc7cNikhF5iej5AEUzzNgFp1HeY/1S998= 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 7d931db02b93..775a72e6adc6 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,