[nfsv4] Re: RFC: new MUTEX_BEGIN/MUTEX_END operations

Tom Haynes <loghyr@gmail.com> Thu, 08 August 2024 21:11 UTC

Return-Path: <loghyr@gmail.com>
X-Original-To: nfsv4@ietfa.amsl.com
Delivered-To: nfsv4@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 43E48C14F5E8 for <nfsv4@ietfa.amsl.com>; Thu, 8 Aug 2024 14:11:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.107
X-Spam-Level:
X-Spam-Status: No, score=-7.107 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MWoJUr9PEaKH for <nfsv4@ietfa.amsl.com>; Thu, 8 Aug 2024 14:11:48 -0700 (PDT)
Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A4092C14F5E5 for <nfsv4@ietf.org>; Thu, 8 Aug 2024 14:11:48 -0700 (PDT)
Received: by mail-vk1-xa2f.google.com with SMTP id 71dfb90a1353d-4f2c8e99c0fso501110e0c.1 for <nfsv4@ietf.org>; Thu, 08 Aug 2024 14:11:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723151507; x=1723756307; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+hpt8bPd/I0JVO6dRcNBtqCFIHMzziUadU/jUFi4nc0=; b=M+qlrmPz8edmRLqwsCaXqzq+i7B10na4HhSwx1WTgHlZTE/AJSUDRoL+MN5Tlc4VSl 5iiPO0490dUhXZI24BtvfVC3xRFdwTBFhnwysJazG6ugGITq8AUXWsNbK8IDx4K3Y/wM b2PbMuFocZGkaY6u7o5nTereyE7qDk8IYVD6oUkoGslXp7TwzEjzRcVfrKF9241hGb4x qHcSf/8+SGIo3SOoY0OUGuzepCyhDpSPlshh8X827JGAOYoCGGafC6bGEnql0AowIp6t JxPhe3uQc0XzpKiGbaD2S/C6d4GOmr+CEnhLTtKx1oOcZHN+J/ntQ44U9z69kWM0KT4m AJWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723151507; x=1723756307; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+hpt8bPd/I0JVO6dRcNBtqCFIHMzziUadU/jUFi4nc0=; b=ovwgPk8gV+t548AiqA4pNUd2WKvP3bleG/NHlo8+tbBfYW8sPExvLxhzWfzRQbseql bYFw0i3iIQ+ebChmlG8Rhu29idOHXWNPD6ujc1ljiuYsJbea7jS1N8gf0dXUalB1Rd3G XxUMx6MUBtoVq3ZEe05AOXxCTW90tYje1AT4iMeW+hbWaz9eHnMwgAQpzMHUqFGDr4kq KXw8xOa3IwbsvrqJjkhQFmfQDX/LrANpDSUGB8G1rw6tyRY/TvmknHmFFa/3oIZs3hki Fp6WGxX49K5eUQHJEASCHPsGxTOYI/GkJH7kEaUAbJIr8mM8jUtE+zVTe12rwXd0+CS+ XlLw==
X-Gm-Message-State: AOJu0Ywqdv4+O0GG4JsSVykmmN3QVLB2aAc5IfvK2xlXm4yZclw/4nPj wls3tvj53c1J5U9wK9MDa1cl2QYnOwI9knw1lRAQ3tPvBh2Y7DjZnHVkz1WYzg6GdXwrFts4IY7 dD3B1hykN2eqKzuQGyQF84l7lPySvaw==
X-Google-Smtp-Source: AGHT+IEwPXKEPgDT5OumgJt4zdHnXKbBQo1Y7iSZ+R4qTkj/c3rCgLQmfgiQVnJHo7OlHi15BbpEL9SBIY8ABvbCcGk=
X-Received: by 2002:a05:6122:318e:b0:4ef:678e:8a90 with SMTP id 71dfb90a1353d-4f9027594cbmr4163106e0c.3.1723151507264; Thu, 08 Aug 2024 14:11:47 -0700 (PDT)
MIME-Version: 1.0
References: <CAM5tNy7g+YCiiZQD7G6Ryv_Mo8N5BeRiqMP=224zPpEXa+Yi+A@mail.gmail.com> <CAM5tNy7qO-b8HB+0xwLbmed6oMbWVO5xksCyn5VJnxy+D9-kwg@mail.gmail.com>
In-Reply-To: <CAM5tNy7qO-b8HB+0xwLbmed6oMbWVO5xksCyn5VJnxy+D9-kwg@mail.gmail.com>
From: Tom Haynes <loghyr@gmail.com>
Date: Thu, 08 Aug 2024 14:11:35 -0700
Message-ID: <CAMa=BDqFcYGVmn131M9Wk_6amtC6NUYOJjds5yrGm6sTxTO8sg@mail.gmail.com>
To: Rick Macklem <rick.macklem@gmail.com>
Content-Type: multipart/alternative; boundary="0000000000007c1b40061f32793a"
Message-ID-Hash: W2FXBWHJI3QTFPVZE73I3GV76LMJFCE6
X-Message-ID-Hash: W2FXBWHJI3QTFPVZE73I3GV76LMJFCE6
X-MailFrom: loghyr@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-nfsv4.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: NFSv4 <nfsv4@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [nfsv4] Re: RFC: new MUTEX_BEGIN/MUTEX_END operations
List-Id: NFSv4 Working Group <nfsv4.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/nfsv4/k4K9p4wYHa0Yk9hun3oKyItm4HA>
List-Archive: <https://mailarchive.ietf.org/arch/browse/nfsv4>
List-Help: <mailto:nfsv4-request@ietf.org?subject=help>
List-Owner: <mailto:nfsv4-owner@ietf.org>
List-Post: <mailto:nfsv4@ietf.org>
List-Subscribe: <mailto:nfsv4-join@ietf.org>
List-Unsubscribe: <mailto:nfsv4-leave@ietf.org>

I've been thinking of ATOMIC_BEGIN/ATOMIC_END.

The difference for me is that they are not per-FH, but signifying all ops
in between have to be done atomically.

Not much difference, except to work on two files, MUTEX_* has to do a dance
with PUTFH.

I.e., if you want COPY or CLONE to lock both files. Or you want to lock
directories for a rename....

Oh, how about a try until available flag. So if two compounds arrive at the
same time, the second waits until the first is done?

In general I support this.

On Thu, Aug 8, 2024, 13:47 Rick Macklem <rick.macklem@gmail.com> wrote:

> Oh, one thing I missed...
>
> On Thu, Aug 8, 2024 at 1:36 PM Rick Macklem <rick.macklem@gmail.com>
> wrote:
>
>> Hi,
>>
>> Over the years, I've run into cases where it would be really
>> nice to be able to perform multiple NFSv4 operations on a
>> file without other operations done by other clients
>> "gumming up the works" by changing the file's data/metadata
>> between the operations in the compound.
>>
>> So, what do others think about an extension to NFSv4.2 that
>> adds 2 new operations:
>>   MUTEX_BEGIN(CFH)
>>   MUTEX_END(CFH)
>> Both would use the CFH as argument, and no other client would
>> be allowed to perform operations on the CFH between the MUTEX_BEGIN
>> and MUTEX_END.
>>
>> I think there would need to be a couple of properties for these:
>> - There would need to be an "implicit" MUTEX_END when any operation
>>   between MUTEX_BEGIN and MUTEX_END returns a status other than NFS_OK.
>>
> - When a mutex is held by another compound in progress for a an FH,
>   MUTEX_BEGIN would reply with an error (NFS4ERR_LOCKED maybe).
>
>> - I think you would want a restriction of only one mutex for one CFH
>>   at a time in a compound. Without that, there could easily be deadlocks
>>   caused by other compounds acquiring mutexes on the same CFHs in a
>>   different order.
>> - Only one compound can hold a mutex on a given CFH at any time.
>> - MUTEX_BEGIN/MUTEX_END can only be used in compounds where SEQUENCE
>>   is the first operation.
>> - All mutexes are discarded by a server when it crashes/recovers.
>>   (Any time a client receives a NFS4ERR_STALE_CLIENTID.)
>>   That way RPC retries after a server reboot should work ok, I think?
>>
>> I am not sure what the semantics for reading data/metadata should be,
>> but I was thinking that would be allowed to be done by compounds for
>> other clients for the CFH. If a client wanted to serialize against
>> other compounds for the CFH, it could do a MUTEX_BEGIN/MUTEX_END.
>>
>> I see this as useful in a variety of ways:
>> - The example in the previous email of:
>>   MUTEX_BEGIN
>>   NVERIFY acl_truform ACL_MODEL_NFS4
>>   SETATTR posix_access_acl
>>   MUTEX_END
>> - Append writing:
>>   MUTEX_BEGIN
>>   VERIFY size "offset in WRITE that follows"
>>   WRITE "offset" etc
>>   MUTEX_END
>> - A bunch of cases where NFSv4 lacks the postop_attributes
>>   that were in NFSv3.
>>   MUTEX_BEGIN
>>   WRITE
>>   GETATTR size, change,..
>>   MUTEX_END
>>
>> So, what do others think?
>> (This was obviously not possible without sessions.)
>>
>> rick
>>
>>
>> _______________________________________________
> nfsv4 mailing list -- nfsv4@ietf.org
> To unsubscribe send an email to nfsv4-leave@ietf.org
>