Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp4543249pxb; Wed, 20 Apr 2022 05:31:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaA0necXywOQegwRbSouYnjwMhnunCAzYJLJlngeJXZFZ/S+yZoe2xlM/mxoXXU3RCpdfo X-Received: by 2002:a17:907:6e88:b0:6da:8f01:7a8f with SMTP id sh8-20020a1709076e8800b006da8f017a8fmr18017527ejc.619.1650457894605; Wed, 20 Apr 2022 05:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650457894; cv=none; d=google.com; s=arc-20160816; b=y6y/gRvBekQifUDKXNhmQFJvY+JV7W/nFxIxGdlPBntCPe904aMUsFoo2IYmVIwmAF oTvPXNCimhqc/8LclZztQQWZLfoZ5hN9dg16kFRZZtFeqSOMSsOxK9QpsDWIr03e58NM 9WCt0yDrCRznCqRIgf2wvIwemhYl9EumByHwLWvqSvLWfsWC6ttqHkgs3RVd7JSsIjGC N+NhbJx84COEgEQdKLAdkRrqeU47f0QTZBKwdYPIF4yCuQceKABKk/Giqj6qjUlvJrze KvjoS9YFcpkkPn3vcGVoaKvDOsm0FftCvaRjiBB/Wi7bSMpYyNrBVkvHaG2bqqgl9bLD q8jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=u4Y3eOaR2D2oLy5UgU4g9qvJhnkbfGO00HLFWR/cxQI=; b=hGR3G3i+Z9+T+QxELGIHgKytPXoOK7AylF+WWq3NiDWhwx5+Wt3b+AdTZzM3hJ5GFE q2y4UThJgx+S/XR2U4bB3h0uKV4lxA94qYugkKMO2PftDWUOUZkHPCK/Y1e9LL4uZVtV ymQic2CF77FRpCCc+xl2JJZbKppgu+mptz5HwAYaSk9udp+imks3xIl8TyMTYZ6d+nRo q+HC4BGM/CdAbdY+iNnuxnLDnJta7ESu01kmVtC2osVBD4oSFOvgALbGmOL4g8dzFdsc yyL87g5ks3y+SXXgGof1xmhAXlqd9zpEEYvuS1GAPglXhOxCdjIDScht2BokD5dtEgi8 uCVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AJfPcBaX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i29-20020a0564020f1d00b00418c2b5be19si1386806eda.251.2022.04.20.05.31.10; Wed, 20 Apr 2022 05:31:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AJfPcBaX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355435AbiDSQwF (ORCPT + 99 others); Tue, 19 Apr 2022 12:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245327AbiDSQpm (ORCPT ); Tue, 19 Apr 2022 12:45:42 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5765339692 for ; Tue, 19 Apr 2022 09:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650386578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u4Y3eOaR2D2oLy5UgU4g9qvJhnkbfGO00HLFWR/cxQI=; b=AJfPcBaXHq79NscCaFoQMMluQvHVQbW6FKHD7d1YORzczWjFCcdGIXXLEyVgWM5LwP4Cmo 7QNc7fduEt6ilf5OixTKQJ9HkcklVOU5DT/dKk1GPa/e7DJG7aBVdNJPdFvGJoFYcoCiLk QXxPveEG+m+Ko5hrWx4iyZ69f7s/MDE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-428-najQBgyjPK2iJtuUqeAHRQ-1; Tue, 19 Apr 2022 12:42:57 -0400 X-MC-Unique: najQBgyjPK2iJtuUqeAHRQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0ED983C11C6D; Tue, 19 Apr 2022 16:42:53 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8FB0C5353B; Tue, 19 Apr 2022 16:42:50 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <507518.1650383808@warthog.procyon.org.uk> To: Max Kellermann Cc: dhowells@redhat.com, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: fscache corruption in Linux 5.17? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <509960.1650386569.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Tue, 19 Apr 2022 17:42:49 +0100 Message-ID: <509961.1650386569@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Max Kellermann wrote: > Did you read this part of my email?: Sorry, I'm trying to deal with several things at once. > My theory was that fscache shows a mix of old and new pages after the > file was modified. Does this make sense? Okay - that makes a bit more sense. Could the file have been modified by a third party? If you're using NFS3 there's a problem if two clients can modify a file at the same time. The second write can mask the first write and the client has no way to detect = it. The problem is inherent to the protocol design. The NFS2 and NFS3 protoco= ls don't support anything better than {ctime,mtime,filesize} - the change attribute only becomes available with NFS4. If an NFS file is opened for writing locally, the cache for it supposed to= be invalidated and remain unused until there are no open file descriptors lef= t referring to it. This is intended for handling DIO writes, but it should serve for this also. The following might be of use in checking if the invalidation happens loca= lly: echo 1 >/sys/kernel/debug/tracing/events/fscache/fscache_invalidate/enable And then this can be used to check if it correctly identifies that it has = an obsolete version of the file in the cache when it binds to it: echo 1 >/sys/kernel/debug/tracing/events/cachefiles/cachefiles_coherency/e= nable David