Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3371491rdb; Thu, 16 Nov 2023 07:54:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlMOnQBRITKy+Fua/y6QPvZCAYzoEOmxJy1wso4UeChse3qcZn/VAghca8IkNI3h1s7i73 X-Received: by 2002:a05:6a00:1d16:b0:6c3:703a:c394 with SMTP id a22-20020a056a001d1600b006c3703ac394mr16236595pfx.27.1700150051343; Thu, 16 Nov 2023 07:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700150051; cv=none; d=google.com; s=arc-20160816; b=ICerWjh7gxQ2fdr5qaouXqK/QNfbsa/gaG0WVoT/2fui2X2gVwEMR+nVIjtgVtachN e3byvIP3l4V0BwB59jkjmZ4oaKHJn4bd6pQtYYSv7WAhEqSihmxqXmIxL1BDiNvhtG0g x2K97VTbyGPXKyu4BI7JYJTO+VtHyMKd8qj4ISjHhr8/YNIcMpVEKNnJw+7Rp+cEAvex JtuxGfWku7VKly7gC8FpsL/zglnia36LSbjl1zTDDtGZMhHSnvYroxE19nAxlveQcVQL bIrBKiN1q1ysV4JIiwZBp0KUJDqDCD173ijp30rHqcXMCo67CrkVfJa+Br2D6BGu471u LloA== 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=BO25tpR4cJ6zDnaYLefhwrjxAjZo0cT3GLAVT5S6v5c=; fh=9hT4l0EMR1D2zdgUoRXiqFwsybSJyrmM/FC/blQlPsI=; b=cWQ/d3vFKonDRf/N4+mwpw3ha6RpvYc0AzcYfXfHPAx7RyVfh11NhvoMNcmoKZV+k6 KkL9mM/BmBrPFXKZza+2/r9ZDCXhblqd8+zEvhBiZEO/3hTUmujWfc4cqaiLFiGrf205 wb3vECOg+BDA0oMDSjtPvFUhaPCDipx8ITHVfOhfpZI7vcdNNVXn8v0ruFEGiGmiL9Al b+pMyyoCVqiqKoSeqkv4gTvqgI/4e/rqnE7uz5w2RylWM+vgdWf52tLG+KQPWXY/6vhM ARDYLNjlFIkPActf6q+GTn5MuRH5Usih80IKVdQpbAYUAc98LxTUntFS41Lx7TXllb8g sckg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IpCE18dw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id y65-20020a638a44000000b005b96cbfacdesi11719189pgd.196.2023.11.16.07.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 07:54:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IpCE18dw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 690AA80A7CEA; Thu, 16 Nov 2023 07:54:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345428AbjKPPxf (ORCPT + 99 others); Thu, 16 Nov 2023 10:53:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345423AbjKPPx3 (ORCPT ); Thu, 16 Nov 2023 10:53:29 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 993C819E for ; Thu, 16 Nov 2023 07:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700150004; 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=BO25tpR4cJ6zDnaYLefhwrjxAjZo0cT3GLAVT5S6v5c=; b=IpCE18dw0AW+utgwBMCTLi6eGdTF6EWPQSOH2r6PKyiDJ078kHIiFquh/1DDrEyAc2gh+n S5bS3S/qMQKZgQFsQK6UfP3UmVDKXyvKMhtBhlY516TOkIa5qeMnq4ONQgNz/gV4Gq6tv+ FdhTYQ+Zs2DRtO9trUwmqL/t0aIVT9o= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-524-TwrH04qRMJORC-m4gYeeZw-1; Thu, 16 Nov 2023 10:53:23 -0500 X-MC-Unique: TwrH04qRMJORC-m4gYeeZw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 9CDE01C06916; Thu, 16 Nov 2023 15:53:22 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEF891121307; Thu, 16 Nov 2023 15:53:21 +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 4/5] afs: Fix file locking on R/O volumes to operate in local mode Date: Thu, 16 Nov 2023 15:53:11 +0000 Message-ID: <20231116155312.156593-5-dhowells@redhat.com> In-Reply-To: <20231116155312.156593-1-dhowells@redhat.com> References: <20231116155312.156593-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 07:54:08 -0800 (PST) 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. Fixes: 6c6c1d63c243 ("afs: Provide mount-time configurable byte-range file locking emulation") 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;