From patchwork Thu Nov 9 15:39:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 163439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp522045vqs; Thu, 9 Nov 2023 07:43:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZwpk1szRuy0oOxqGh+OZRPKRpaKUAM2Oj0BH/3oopu6NXynI/DiN617FQK8gR0mhMnY/F X-Received: by 2002:a17:903:2606:b0:1cc:76c4:5144 with SMTP id jd6-20020a170903260600b001cc76c45144mr5055449plb.12.1699544631676; Thu, 09 Nov 2023 07:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699544631; cv=none; d=google.com; s=arc-20160816; b=x8dDybdJmUXYGHfu7v4mNUIUN6J7pRgufwPGROtMLQUv0xHoZn9gcKVYTnVqpWV98z zEgNfP6i0V2KYrABTzAqxDFEePfipKHJcez/QOt8xUCjpkbPOG73h8hq7YfSrv3psh1G YBfWmqAXezn6zV7MazUtwisDKGpL2Z4UNtTY4VdwR3eZQ71cubosNYMAg1wfU0GUUPuB uPAaBQ/w+Sm2ZC2ukPcoHKnowzchkzi5nakd5r9N+EPRVnH9RSBTZX6WpIE5aTJ/pvf5 EHh6rwezUaMZ8kqkS0nF/VWAfkjVGT6NH1Aa0bUmc+yV5Qe0PcH9qWFjHdASJvtZRYeN lOAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=J/pTKsJQlHOrVc1geBfbdiV2EMa2Bfv5xj8BaG3Mi98=; fh=9hT4l0EMR1D2zdgUoRXiqFwsybSJyrmM/FC/blQlPsI=; b=b73pSSoqfZAuBsaeOIAIizlcTwAr06bGljVIlSdG+GNP2Mt0NVnk63+te55/f0/O5Z Px61v+wncIIk1v8ZygIy7b2V/0dqeD+TxiykYyP8GvjMzDqWwWbi8/RpFPJlC9txljlB o9z5Qxa8+Dxf+uc8UkrKaV0jhOpFOHA7sQLPnEsDNo+j5kdtTpmJhwDUaUdE8xhDiwMO a/HwYQPJ5/gC3Dn4BpPWL1kRHFBfyp7ZNOyORNH4b7zAueCH8nsUstYRjBP4zgWzxkDQ y0F6wXq1XN0mbKRIw4lR2V3m5LWbxAXrAPOcnxuSF+Xac1VNKLtNJuEe5v2E5e8BuAfo E8qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Htlp83e9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id w7-20020a170902e88700b001cc5420241bsi5508234plg.413.2023.11.09.07.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 07:43:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Htlp83e9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D361C8376E7F; Thu, 9 Nov 2023 07:43:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343849AbjKIPnn (ORCPT + 31 others); Thu, 9 Nov 2023 10:43:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344178AbjKIPmo (ORCPT ); Thu, 9 Nov 2023 10:42:44 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EFA73868 for ; Thu, 9 Nov 2023 07:41:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699544469; 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=J/pTKsJQlHOrVc1geBfbdiV2EMa2Bfv5xj8BaG3Mi98=; b=Htlp83e9UeRhRkqQaGkFZXElvVXx6xwlP96Oe9D7PdMm8zE58/ofL9uI0yBCcs7ELi2tH4 1hrMMJtoCwc9E0YvhxCZ2QdDwHq3xDeNS7HIrTBqtQInKZYdYENdPUi/u9V9HNn1rYQng8 l2oUPRtmQg+zo/QUORUiJC4/hEP7lXA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-631-OO4IYWXfMCqOqSwUMi_W4Q-1; Thu, 09 Nov 2023 10:41:06 -0500 X-MC-Unique: OO4IYWXfMCqOqSwUMi_W4Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85832101B047; Thu, 9 Nov 2023 15:41:05 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id B387B492BFA; Thu, 9 Nov 2023 15:41:04 +0000 (UTC) From: David Howells To: Marc Dionne Cc: David Howells , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 32/41] afs: Fix file locking on R/O volumes to operate in local mode Date: Thu, 9 Nov 2023 15:39:55 +0000 Message-ID: <20231109154004.3317227-33-dhowells@redhat.com> In-Reply-To: <20231109154004.3317227-1-dhowells@redhat.com> References: <20231109154004.3317227-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 07:43:49 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782101711374551433 X-GMAIL-MSGID: 1782101711374551433 AFS doesn't really do locking on R/O volumes as fileservers don't maintain state with each other and thus a lock on a R/O volume file on one fileserver will not be be visible to someone looking at the same file on another fileserver. Further, the server may return an error if you try it. Fix this by doing what other AFS clients do and handle filelocking on R/O volume files entirely within the client and don't touch the server. Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- fs/afs/super.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/afs/super.c b/fs/afs/super.c index 95d713074dc8..e95fb4cb4fcd 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c @@ -407,6 +407,8 @@ static int afs_validate_fc(struct fs_context *fc) return PTR_ERR(volume); ctx->volume = volume; + if (volume->type != AFSVL_RWVOL) + ctx->flock_mode = afs_flock_mode_local; } return 0;