From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB6DDC433F5 for ; Tue, 19 Apr 2022 16:49:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355459AbiDSQwH (ORCPT ); Tue, 19 Apr 2022 12:52:07 -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 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