Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6194979rwd; Wed, 24 May 2023 12:07:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sLFTFfjIHWhU1B3ifkvGazRVZfKemU0xv/h2V7pLgca7qSjQimGzFz3PLJJtBeUgsVOlz X-Received: by 2002:a05:6a21:790:b0:10c:ef18:7473 with SMTP id mg16-20020a056a21079000b0010cef187473mr3869737pzb.56.1684955242786; Wed, 24 May 2023 12:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684955242; cv=none; d=google.com; s=arc-20160816; b=PNcKpoNefqTiql20pPi551Ae9qhDP9euYJYn4fp9VL0rhrA+1WgOcpKFB0iTTiTMZ+ hwpEkXXsTlM1fg8x2HylCs4avbFti0p66X7ELWKoiaCkIEZzXTBDhOoKAzarJNXXqgaR EeKCMFm5LJ5e8o7ivSPiKhjjnFy+D6nRZicU3MFfZ+KP3a2wGeM7ncpoNR2p9pSOAQG6 Ky34JxnwA8l5Kdy9skwREy/UEPOOE62gr3AtKAw0PY9C6PPwGHoEMPGaQJqjzTGjBUG1 KdGWEe62U/M7jXaatV44yS99OLVUZ9VOI08Vsazpu6YVyk459jRwZp8hZhrmfYMO2gRg Isaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=EJ6/cVdTU/iSLJRZMj2G0xc6W/IPIkHFjdhuGSW6WyM=; b=QD9p9+4vJlJrqqI6CIqgV/OQnhnfWwv2TD1QQ9Wy1YCasajrlnZ4Gywg1z3D7P88F3 iy8zeRjH19rn7oNafB/V/yHfQ/CKV7UfzNjHWS9p6SFMNwELnac3CZWuQUk9NQUQfr19 rwoHjzLpvs8ULCOmANiXZwOJA9zF604sgR5+lsIBXPh4eZqLmiyJa+CTv5Nth/Ca1myK HlfsnYb++4NC6pn7JqG8tvEkjkb3pOL7gln19qivSKVGBFpXiJ55inyhUJBmScuEj7NK SmQ2cMscejHsUhd3xVE6VlE+TLQmIiGV2hX8+vlO/7eons6fAeEbFzW36C3ayamKh1b4 h6qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ApZVtCj1; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a193-20020a6390ca000000b005307598826csi520580pge.87.2023.05.24.12.06.59; Wed, 24 May 2023 12:07:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@kernel.org header.s=k20201202 header.b=ApZVtCj1; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231785AbjEXTDc (ORCPT + 99 others); Wed, 24 May 2023 15:03:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233095AbjEXTDa (ORCPT ); Wed, 24 May 2023 15:03:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 812BA119; Wed, 24 May 2023 12:03:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16DBA60EFB; Wed, 24 May 2023 19:03:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12B65C433EF; Wed, 24 May 2023 19:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684955008; bh=ibpSB5X+aojA3C7XXWRsgXXDfsbiBXjmlM1EiV0jMUM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ApZVtCj1i0qi1WtVDxenPoHM34KI9WKKq2lovXf0jyH1XbEaf2bSVg0USTO8rKjgG T6AGFeIu0FjNPdu9iYM+z06hewtI4CYjIUVwhGrcEuLLWRv9pIW8XsSjK82+rhwIfY s14G5zYH+3eG4VjPEQauz11sXBD6LzRp9Z37X09o7OUrUjuVZpUSISr+VYpqRXnqNy T6HAER/h2ZZlNV/injnIa69NOEki6zpRK/Ht8KNr3DKwOjNY3ujQhNMdTO+Hf8wFg1 yvCzT8mDrcdDuqtVLHgwwQ3TMgnhScxx98B7mZ3iaEGsQW6GyZ6SXmhBC5Qmfy/+X4 jQXEJ1xS68w9A== Message-ID: Subject: Re: [PATCH v5 3/3] locks: allow support for write delegation From: Jeff Layton To: dai.ngo@oracle.com, Chuck Lever III Cc: Linux NFS Mailing List , "linux-fsdevel@vger.kernel.org" Date: Wed, 24 May 2023 15:03:26 -0400 In-Reply-To: References: <1684799560-31663-1-git-send-email-dai.ngo@oracle.com> <1684799560-31663-4-git-send-email-dai.ngo@oracle.com> <32e880c5f66ce8a6f343c01416fcc8b791cc1302.camel@kernel.org> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.1 (3.48.1-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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-nfs@vger.kernel.org On Wed, 2023-05-24 at 11:05 -0700, dai.ngo@oracle.com wrote: > On 5/24/23 10:41 AM, Chuck Lever III wrote: > >=20 > > > On May 24, 2023, at 12:55 PM, Jeff Layton wrote: > > >=20 > > > On Wed, 2023-05-24 at 15:09 +0000, Chuck Lever III wrote: > > > > > On May 24, 2023, at 11:08 AM, Jeff Layton wr= ote: > > > > >=20 > > > > > On Mon, 2023-05-22 at 16:52 -0700, Dai Ngo wrote: > > > > > > Remove the check for F_WRLCK in generic_add_lease to allow file= _lock > > > > > > to be used for write delegation. > > > > > >=20 > > > > > > First consumer is NFSD. > > > > > >=20 > > > > > > Signed-off-by: Dai Ngo > > > > > > --- > > > > > > fs/locks.c | 7 ------- > > > > > > 1 file changed, 7 deletions(-) > > > > > >=20 > > > > > > diff --git a/fs/locks.c b/fs/locks.c > > > > > > index df8b26a42524..08fb0b4fd4f8 100644 > > > > > > --- a/fs/locks.c > > > > > > +++ b/fs/locks.c > > > > > > @@ -1729,13 +1729,6 @@ generic_add_lease(struct file *filp, lon= g arg, struct file_lock **flp, void **pr > > > > > > if (is_deleg && !inode_trylock(inode)) > > > > > > return -EAGAIN; > > > > > >=20 > > > > > > - if (is_deleg && arg =3D=3D F_WRLCK) { > > > > > > - /* Write delegations are not currently supported: */ > > > > > > - inode_unlock(inode); > > > > > > - WARN_ON_ONCE(1); > > > > > > - return -EINVAL; > > > > > > - } > > > > > > - > > > > > > percpu_down_read(&file_rwsem); > > > > > > spin_lock(&ctx->flc_lock); > > > > > > time_out_leases(inode, &dispose); > > > > > I'd probably move this back to the first patch in the series. > > > > >=20 > > > > > Reviewed-by: Jeff Layton > > > > I asked him to move it to the end. Is it safe to take out this > > > > check before write delegation is actually implemented? > > > >=20 > > > I think so, but it don't think it doesn't make much difference either > > > way. The only real downside of putting it at the end is that you migh= t > > > have to contend with a WARN_ON_ONCE if you're bisecting. > > My main concern is in fact preventing problems during bisection. > > I can apply 3/3 and then 1/3, if you're good with that. >=20 > I'm good with that. You can apply 3/3 then 1/3 and drop 2/3 so I > don't have to send out v6. >=20 I'm fine with that too, particularly if other vendors don't recall on a getattr currently. I wonder though, if we need some clarification in the spec on CB_GETATTR? https://www.rfc-editor.org/rfc/rfc8881.html#section-10.4.3 In that section, there is a big distinction about the client being able to tell that the data was modified from the point where the delegation was handed out. There is always a point in time where a client has buffered writes that haven't been flushed to the server yet, but that's true when it doesn't have a delegation too. Mostly the client tries to start some writeback fairly quickly so any lag how the in the change attr/size update is usually short lived. I don't think the Linux client materially changes its writeback behavior based on a write delegation, so I guess (as Olga pointed out) the main benefit from a write delegation is being able to do delegated opens for write. A getattr's results won't be changed by extra opens or closes, so yeah...I guess the utility of CB_GETATTR is really limited. I guess it _might_ be useful in the case where the server has handed out a write delegation, but hasn't gotten any writes. That would at least tell the client that something has changed, even if the deleg holder hasn't gotten around to writing anything back yet. The problem is that it's common for applications to open O_RDWR and only do reads. Maybe we ought to take this discussion to the IETF list? It seems like the spec mandates that you must recall the delegation if you don't implement CB_GETATTR, but I don't see much in way of harm in ignoring that. --=20 Jeff Layton