From patchwork Thu Oct 24 14:05:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13849275 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 43832CE8E7A for ; Thu, 24 Oct 2024 14:08:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CDC2E6B00BF; Thu, 24 Oct 2024 10:08:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C96906B00C0; Thu, 24 Oct 2024 10:08:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B05148D0003; Thu, 24 Oct 2024 10:08:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 904496B00BF for ; Thu, 24 Oct 2024 10:08:12 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A0057ACD9B for ; Thu, 24 Oct 2024 14:07:35 +0000 (UTC) X-FDA: 82708674006.20.C806443 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 5CFCE100030 for ; Thu, 24 Oct 2024 14:07:35 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TqSlU8bc; spf=pass (imf05.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1729778686; 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=R2M55uMJMAyivWUBuIulUSI+Dm49cvpyqetfRtNBjZqmsYspBMda3auybEobaTgPkLasYy P1hnuJtcnKuHRDiG+o2f4fm/7qZXEzCcS5BW0GGGftVLchppjoCYfYT8bayMzcjL25lOq1 f9Zsp2cS5xRLIjgxay7IqTEG1/K4l+g= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TqSlU8bc; spf=pass (imf05.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1729778686; a=rsa-sha256; cv=none; b=S33wcfxq3ueZgG4PNi1G3v3iEwdtps7O7+0uGk7mJez+xrpgBHeGA8fET+s2ucOEB8L35J sEDxkzuQeasFCgBb+z5tTdd9CCb3GgV46+o89C1f/+l3pA4dTrC/SAyb2b7EOeKBcbzVDO 1U0JGzvNlKrW4qLKQB8BDYb2M32Bf70= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729778889; 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=TqSlU8bcQV59xHTTmVPdkVEthkTtOuLSbmNwUDemhAbnlcySAwl4g85n0nBEf+Lh8B9E6n iWpEAA1qT5hY92IVXBZw88do/d1tL2mqbS0vfgtYktn/+ZOwCQSXcFcMka2egmyAfwkvBa pptPaGNKo7v3vey5h/ODy7Cv3A3Lne8= Received: from mx-prod-mc-02.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-336-LJzRLwyPP5e6Mlw0i1E05Q-1; Thu, 24 Oct 2024 10:08:06 -0400 X-MC-Unique: LJzRLwyPP5e6Mlw0i1E05Q-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7271A1955D52; Thu, 24 Oct 2024 14:08:03 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.231]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E72E61956088; Thu, 24 Oct 2024 14:07:57 +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 17/27] cachefiles: Add auxiliary data trace Date: Thu, 24 Oct 2024 15:05:15 +0100 Message-ID: <20241024140539.3828093-18-dhowells@redhat.com> In-Reply-To: <20241024140539.3828093-1-dhowells@redhat.com> References: <20241024140539.3828093-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5CFCE100030 X-Stat-Signature: cytggm4o1kht5hwoc5g47qja7ckk5wwp X-Rspam-User: X-HE-Tag: 1729778855-92359 X-HE-Meta: U2FsdGVkX19wvlpYnjWVo35ZnWAsGdmMd8SxiVY3/lvc8/sDPeSloFlgPJxLePY1jfIEnXBNkhpj9Io4KIRD7EwF5NxkOJia3BnIRrlLsYjpsEdt7M+qPV1nLMBFqpQARWni50z+ea56sPG4/Mrsymh+Da9ZFZUjQuWClrl1knq1V+Dyy6L+aJsK2/f32boZoSKJbu31Ae7w3WNyDFBXNEglELSWVaPFBOH5bUT1Qbt0mO/HxE+vqngsKfipcwZ8Fa3nuZ12eXMkk86q13F9uDaLb3y+yjE3YP8sC34sjlMewS49ei/2DHoSR5+Sa5sY9Dq4mYMJnTfsReMlRGc8PBeLNau7RxZ3EOnHlufV8aJpq2HLk5j5ZaqSk9yyrzT/RfO8rp5VmJlHviYiZLZnJGF/bZ9E4GTjvJOKNa4SrKKwoz2ZZvGazwh3UfmrLxqjDXzHYSQrRIHFoZAdRez093v+hwkVh7fDLstSYV6+FXsbvGuIpGkG5phZ7x0f0kVzcAQhEGUO6W2dXgc6laBEv93qbBFNuj27XdBkF42Z8bcYYJslD4i62L7oXWS7XVdgYtKkuBir9ezGIr/dR4L9P9XN5Euo1HO9XzvHrI0iKrs8iEhKWfj/TSPtiLHqDRMvefRmE1ZPScImDsjDcmgOavtx83d+JgXTNZeUrp9kEaiapvWK9ZjImKeRWJ8V+9QyIrpJnYDgMzbDhy0NvqOXx1j/1aG1dvZ7SYeOeARi41960eqiSQBVgvQ4eyTNTd4HUxqhqbguMNUJMbiYEzriYaWL917sTMQ2/J67gvGotFDtuqWQUP7r95QDCoBNwsi5hxF4rnGpJWN/ZtSqjY+a2OkpLxLCAHcZ5Oeg3lYxFs8r7p5X4iGhbzP4l8At65Qls7Jq2c8umrU5Czf/ENi3aNJCcJ15doQHeS915gi32D7i88cou0F0TjBWYGwX2CWD8hx82h+eUUfB6s5laUS pXbX7A3e p+qV3FZYz+JtvjBbjgULfIAYqDYnvMIyCjTS1+2yf30KALKcgdAi+GrOmCzSG9QQN1MKUI65bIn56xI7ofgBcmJWs9wFTVC2napS5Nkstu5RqU9WgXFwv3wSogA8yHkFsSSZKFYylY41YkQYUh8OTPeuHJtIroZdaC7W3VlCsBANAN2gtea2BNdFb6xNSsfCFcEuHS03qii/zPEHuI00IeiM+JKh594l2OtMiDXKrOThkajv900yeotcyu+QjZ/mxI2leaqhoKBTgowPD/41WqEEQftQ/BG+aKTZvXIUB/4v+AccnuDC59IgJdAPMH0iDP9GdHZbSCvGZ79AO2pCSddSP5u7GFggaH3KG 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,