Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2620177rdd; Fri, 12 Jan 2024 16:09:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHq+BuPHrVZCdd1wJeeZUnhVCjY/dtCYTfY4iY4F0cWY5ar4B/BDG/CILFoXUbPpos0Cpj1 X-Received: by 2002:a17:90a:3949:b0:28d:bd5f:1e5 with SMTP id n9-20020a17090a394900b0028dbd5f01e5mr1857842pjf.44.1705104575669; Fri, 12 Jan 2024 16:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705104575; cv=none; d=google.com; s=arc-20160816; b=Q0qP2F3e0ZNgGhsw4SM4JoQbyOmj/9IYeEjyXTwAJzyvPG+JWDwCpmlhsBoHqd20AW oLR550TaHTs+fmq/w1C39777beUY0rUxQfrl+VyB6xjHEmCs9od6zTcVpsTFI/dUegYV pVmecMKPUlAt35Smj9cU4wGCT9LlO+PG+AbrLzsOTgjEmgrXwpQoCajlOUOVDIuZNALX UK/3GxVZlp+nVpvb6Pxf+U+B4Ip2KaB2nAzjy9shIQljOn1WHoC6+RSz04t2ONMUwDUx hcqr3byZUx/b3o6Z7WEe7N8oMrHEjVvEH1K0Qo+zlQ8Tjymeh06A5J/YYUFsi1L0AfjJ WdBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=f3geMRT4lnWRt6j00DLGFwhbGaONKIiYxTrQBD9NUuo=; fh=BdJuxCX4Z0o85kweHW25UrNsgJxmwxc/myv8u1BdP/E=; b=jC465x3zmJ9SITIAVWlEZHVIV0rSiY8KgtzzacoEa2F9T3XgunNRL4FyVxAzEi2Ae1 Ow5/cXDZFa5EGnAPAmuz/EGAoU1MGYh8Xupus/+GyfZCSUIHmi/dyV1VklbXGgKdPNOc ukqMcItoUJERkvvLXf76H4oNY/1YeYpUheEYWUjcY4YiDTrqURONsj/Id7eUZVkrmrjk 0GgDVStKOZNcOjbmIMIQZGTDYxWnyUqfttdPC9nOlFKIjppVDpEY9UnoUs5FVGFIFNc3 kZWk19P6HlCA39Hl7+rE79xDTgDlrHk2cfYPTdG+IjqYY1GhBB/WMy0bz+KOmPYlfiXM ErlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DlPE5B8f; spf=pass (google.com: domain of linux-nfs+bounces-1065-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1065-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id oo10-20020a17090b1c8a00b0028e0ff6cb87si1770472pjb.102.2024.01.12.16.09.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 16:09:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1065-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DlPE5B8f; spf=pass (google.com: domain of linux-nfs+bounces-1065-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1065-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1C98F287807 for ; Sat, 13 Jan 2024 00:09:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01DA2195; Sat, 13 Jan 2024 00:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DlPE5B8f" X-Original-To: linux-nfs@vger.kernel.org Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1403C364 for ; Sat, 13 Jan 2024 00:09:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-50eab4bf47aso6059960e87.0 for ; Fri, 12 Jan 2024 16:09:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705104570; x=1705709370; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=f3geMRT4lnWRt6j00DLGFwhbGaONKIiYxTrQBD9NUuo=; b=DlPE5B8fW7rVVJP5NAFOOj2yEgAN9Sj6WyNajsnizrqcgX21vmVOlPkxSAmByo5W8d Azy65ULEn3XTddwf5RCTBT4H4vPwVCzAahUN82QAVqJZakcq5eUXc2hc8P60n43+Ew1Z O+IocvXV/8rps1WMfB9ic2kDw/6M+E43iI29mqcNMmwahH6P9vXSO33Lk+i9WH4rkPhO didSBye/IxvIunh9KqqZI4aEDoiXERZbF9oNzz/PcCDRprQ7vjRWQscZgxy3qmjjraaI u0EBtuhoYxTqgU7FKOrATod1o/wpY+XZaMab1j4Qx0ZhkY6YO/x9PuDaXGTEESRn99cU p4Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705104570; x=1705709370; h=content-transfer-encoding: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=f3geMRT4lnWRt6j00DLGFwhbGaONKIiYxTrQBD9NUuo=; b=puEpRvit2X9K/WY2AoBVkmFH0ttgaNwdrI1rnMNzjCuPiPtx3oAODnP5RVVoCtI0eN Ex9E+Cuh4Qea1uEF87rf/hElh/VTcMzRPoxKKUXmz8mBNFupNHcP15sq4eFAixP2/jrW 7Gx32s113mgw4hPYCd++trEvhIOgOV7AI/GOcCYsCvB3biSnl4KvhRFFyApTChIzn6+2 5YYWCAMjEA2EOBVsAFt7/6IYy8ixmT6+qG8LzE1qX6cLYs95EFKvp3mgNa0FoefsHJFE nsTyisjuzhjnV0bx/lHIYroRRIRd1UrDeu1LoYAXRajgKYP2N1mqpCO8IKftD58C3Uan /EpQ== X-Gm-Message-State: AOJu0Yxy1ID42YgwuXeQ0jBenHFN+hxbTJ5QYYxlhhTWa4GIAdZ4hNa5 NmtI/2H5CfDt097iteA34gD6lB3i6nJmcBkFlMdprA64iluHBg== X-Received: by 2002:ac2:414f:0:b0:50e:9354:67d0 with SMTP id c15-20020ac2414f000000b0050e935467d0mr965846lfi.14.1705104569825; Fri, 12 Jan 2024 16:09:29 -0800 (PST) Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <39adc7fc114c6f8ea38fe7c846c322dab5fac907.camel@kernel.org> <5057fdb94f4d61661f9d13ccadb775a3a5bcdc92.camel@kernel.org> <6065a76f32face0fa5cf84a238bcb1f2eebec7b5.camel@kernel.org> In-Reply-To: From: Dan Shelton Date: Sat, 13 Jan 2024 01:09:03 +0100 Message-ID: Subject: Re: NFSv4.1 mandatory locks working in Linux nfsd ? To: Rick Macklem Cc: Jeff Layton , Roland Mainz , Linux NFS Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 12 Jan 2024 at 20:45, Rick Macklem wrote: > > On Thu, Jan 11, 2024 at 6:25=E2=80=AFPM Dan Shelton wrote: > > > > On Fri, 12 Jan 2024 at 03:13, Rick Macklem wro= te: > > > > > > On Thu, Jan 11, 2024 at 5:25=E2=80=AFPM Jeff Layton wrote: > > > > > > > > CAUTION: This email originated from outside of the University of Gu= elph. Do not click links or open attachments unless you recognize the sende= r and know the content is safe. If in doubt, forward suspicious emails to I= Thelp@uoguelph.ca. > > > > > > > > > > > > On Fri, 2024-01-12 at 01:44 +0100, Dan Shelton wrote: > > > > > On Thu, 11 Jan 2024 at 23:53, Jeff Layton wr= ote: > > > > > > > > > > > > On Thu, 2024-01-11 at 22:27 +0100, Roland Mainz wrote: > > > > > > > On Thu, Jan 11, 2024 at 4:55=E2=80=AFPM Jeff Layton wrote: > > > > > > > > On Thu, 2024-01-11 at 10:54 -0500, Jeff Layton wrote: > > > > > > > > > On Sun, 2023-12-24 at 18:29 +0100, Roland Mainz wrote: > > > > > > > > > > Are there any known issues with NFSv4.1 mandatory locki= ng nfsd code in > > > > > > > > > > the Linux 5.10.0-22-rt-amd64 kernel (technically the De= bian Bullseye > > > > > > > > > > RT kernel) ? Is there any kernel or NFS test suite modu= le which covers > > > > > > > > > > NFSv4.1 client mandatory locking ? > > > > > > > > > > > > > > > > > > Linux doesn't support mandatory locking at all since 2021= [1]. The Linux > > > > > > > > > NFS client and server therefore do not support v4.1 manda= tory locking. > > > > > > > > > > > > > > > > Forgot the footnote! > > > > > > > > > > > > > > > > [1]: https://patchwork.kernel.org/project/linux-fsdevel/pat= ch/20210820114046.69282-1-jlayton@kernel.org/ > > > > > > > > > > > > > > OK, this is pretty bad in terms of interoperability.... ;-( > > > > > > > > > > > > > > What should a Windows NFSv4 client (Hummingbird, OpenText, Ex= ceed, > > > > > > > ms-nfs41-client, ...) do in this case ? > > > > > > > It basically means that locking for these clients will fail i= f the > > > > > > > server does not support it... ;-( > > > > > > > > > > > > > > > > > > > I think they have two choices: > > > > > > > > > > > > Learn to deal with advisory locking, or contribute some sort of= (sane) > > > > > > mandatory locking implementation to the Linux kernel. > > > > > > > > > > None of this will happen. > > > > > 1. Advisory locking cannot be mapped to Windows mandatory locking= . End > > > > > of story. They are incompatible. That is why the NFSv4 protocol h= ad > > > > > mandatory locking built in into the first place. That was the gra= nd > > > > > design and the grand dream. That is gone. > > > Are you sure? > > > What about the following (in the same compound RPC as the Read/Write > > > operation): > > > - if the byte range being read/written is not yet locked by the clien= t/task > > > Lock byte range using a lock_woner4 that represents the task doin= g > > > this Read/Write > > > - do read/write > > > - if Lock'd above, LockU the byte range > > > > > > As I understand it, the only difference between advisory vs mandatory > > > byte range locking is that, for mandatory locking, the Read/Write wil= l > > > get a reply of NFS4ERR_LOCKED when a conflicting lock exists. > > > --> For the above algorithm, the Lock operation will get a NFS4ERR_LO= CKED > > > if a conflicting lock exists. > > > Isn't that at least roughly equivalent? > > > > > > There has always been problems w.r.t. mandatory locking in NFSv4. > > > 1 - No way for the NFSv4 client to know if the server is implementing > > > mandatory locking. If you look back far enough, you'll find that= RFC3010 > > > had a flag in the Open reply that indicated "mandatory locking".= It was > > > dropped for RFC3530 and nothing else was added to replace it. > > > 2 - I could never see how write back data caching could be implemente= d in the > > > client when the server is enforcing mandatory locking. > > > --> The write back fails with NFS4ERR_LOCKED. What does the clie= nt > > > do then? > > > I've concluded a client must either do write-through data cachin= g or byte > > > range lock all byte ranges of all files being write back data > > > cached. Neither seem > > > reasonable to me. > > > > > > For a long time, I did have code in the FreeBSD NFSv4 server that > > > could implement > > > mandatory locking for NFSv4 clients only. (It is really only a check > > > for a conflicting > > > lock that is done by Read/Write.) I eventually got rid of it because > > > no client wanted it. > > > > Rick, welcome to https://github.com/kofemann/ms-nfs41-client or > > https://www.opentext.co.uk/products-and-solutions/products/specialty-te= chnologies/connectivity/nfs-client-nfs-solo > > I think both clients want that. > Well, 20 years ago I beta tested the Hummingbird client (I'm surprised it= is > still a product, since I haven't seen those guys at a bakeathon in a long= time). > ack then, it was basically a port of their NFSv3 client and I do not reca= ll that > it needed mandatory locking (or other features you have asked about, such > as named attributes and system/hidden attributes), but it has been 20year= s. > I wonder if they ever upgraded it to NFSv4.1? > > As for the CITI code, it was meant to be a prototype and until recently s= eemed > to be dormant since work stopped on it at least 10years ago. New binaries with new features and bug fixes every month does not look "dormant" to me: https://sourceforge.net/p/ms-nfs41-client/mailman/message/58718627/ > > The short version is "Since Microsoft never adopted NFSv4 as an alternati= ve > to Cifs/SMB, there is no significant demand for these features. Microsoft is selling a NFSv4 SERVER, actually with support and bug fixes. Hell knows why they abandoned the CITI project Dan --=20 Dan Shelton - Cluster Specialist Win/Lin/Bsd