Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp46129lqs; Thu, 13 Jun 2024 03:27:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUyadluTOvoKIXaLe4R+i0B+Tplvv8YWMWz59B5//bjbD0dGr1F5yrfACafM81A+E4XXwMqQC+UZ13oQNcmfionHglSoZID9D380kb3AQ== X-Google-Smtp-Source: AGHT+IH2Ag7K15iq3koRW7OskfqiFpXEy2QV7OGUuFhf2aLBnK57CiLWwm0ATbME49e/zbPEyNVp X-Received: by 2002:a1f:fc81:0:b0:4ec:efaf:a01f with SMTP id 71dfb90a1353d-4ed07b0f908mr4375082e0c.7.1718274429073; Thu, 13 Jun 2024 03:27:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718274429; cv=pass; d=google.com; s=arc-20160816; b=fURowCmbvSwb6Yeq0wdje6/NTOPWL1EltUWH+vSDwTN0KwOh2Z3vVYgE+bR5ZSNBLi 7qFqHtpKMMmZbneyArye6fZ7doRwbBvseFGJIr7HBTKjJ6K5tuXky35+VlJTTSpG53Rx Psuoq5U5kIV6rVnX6tcWaxnWC3eMjeL3HEFSMR5ujBkeokE60aGha8mn3I/hOE4ZM5de 4EQd6skbBBZrIKfyqqYYv3E6yEjhU8Qr7UwPruq0DBPu9SB3NAJhRSduHRQkwWfdWrJV qbPI9G8ESZOQA+71Z0rh0bBE8jWO20Wco5x3JkC2pXDzWRzx0o9uXlYl2wlA43vcNyQS ZY4g== ARC-Message-Signature: i=2; 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=msMt3NoK+jnD01K6V9N2dPJ6/bT7gdjIrrO/A0HcAWw=; fh=tKtY9vBS4qaH0LiEV9MVD1YEqphVCIqMms3fWFP+Ckk=; b=HRKel32C4tPWrLaFe6g5ES5WXcRE7GPJhSbB3RSpTK31arRV/o9SJMDiFIWBuFLfsY iBsJCTFfjfRcHVrcDf5Wxn5q9jHr4J8QsFRw7n5qiBJpSs28AA03cyFQQ+OaYr6NtKT8 8/LgU8qHQm/aLfWYria+vKqKLyQV/4rDb76UIDej76zIZ4hLN7zsB39MMRJ6T9TuJ9j1 LfuUfkLBcYeSu3qB3ssByjpVSfYGWoT49rymqIf9bdrdpcMBdjtH1ff5rUn6hqFGdeRx A1or9tMCMlIvWz6XJZdHC2KBdqqcop3jI6YR3SfV40plccnRzy6Dpq7zj42EBgiiPbIG 5vqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Qcfm2f+i; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-nfs+bounces-3751-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3751-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798abd1d21asi102702685a.447.2024.06.13.03.27.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 03:27:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3751-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Qcfm2f+i; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-nfs+bounces-3751-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3751-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C7D311C224A6 for ; Thu, 13 Jun 2024 10:27:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3CE31411E1; Thu, 13 Jun 2024 10:26:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qcfm2f+i" X-Original-To: linux-nfs@vger.kernel.org Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (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 4C09114265F for ; Thu, 13 Jun 2024 10:26:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718274413; cv=none; b=hF+OZ2okoiAJaLZoyDusnXz0cglETf+TizjJPeZsWTjyHys4yGSWIqyj1O0WE5viuhV/wXh7DXRiuBl07EoTO05NtMunknqmt658LrijiBKEHthwec6IlfUT8AMeVQUIhk69X3m7LJhbcu2LGEV3lyI0twVytJOmXKrWquf/zV0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718274413; c=relaxed/simple; bh=HmS73kzo/BSVJ2FmT15ot7+BuMipU7gDKCIHSkeMdmE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Cqnp3ph9To6QTmYq5wZVghtZK/mDI18hvJg0t68ca76Bi2KR7HUan4wOqDxBhpCqs6VPagD1W9cbfaxTxFwP91ilI2yxRZepSGFV8OFyB5c3tNqtgdFoQd2X+yMN/369pLl/kpkcNgeQ68//63faxTdbmYOgs/2zbnpuYfI+CJA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Qcfm2f+i; arc=none smtp.client-ip=209.85.222.171 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-qk1-f171.google.com with SMTP id af79cd13be357-7955aaf8006so64519685a.1 for ; Thu, 13 Jun 2024 03:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718274411; x=1718879211; 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=msMt3NoK+jnD01K6V9N2dPJ6/bT7gdjIrrO/A0HcAWw=; b=Qcfm2f+i0XLnzRWo0P2NLr0oLK3fBBnlZUW34u6gneoCaxZr/O1bv3F+150j6MzyMd o3pTRipXA/pAkvVinurp1lcJimD1L3fpgPjwgYUrgiqSazf2TFN2AkrKj0SxlgzQJnj6 7iFc3rBI6OcRyxIkc/s5VlLgPgcviYDSevq/oFdHJjROixCBc5zmdVVl0QmA7Qxip7Al 1FMf0XR9bZRdX71pvU/uILSRAZj5QhOBb0ArNKT7UbCs6aPaso6OYPpVh8W+AcsLHno6 aNE0Mpw738SqMDWFOrvKRH+Cjs9+E2Y1KvhEzFU/ptEDd7rGDyi2GoRu1VV9iytrh+Um 1uzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718274411; x=1718879211; 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=msMt3NoK+jnD01K6V9N2dPJ6/bT7gdjIrrO/A0HcAWw=; b=lXKqygckg51zjKgclb79BDYH3C8B9xaK1V+KmWyuJgT61LJPHGPo6vHsPIiiAsx5Uq K9d9zAsx8d6uestEI28tDWq+qsG8g0WAWtGhMcOZfuL2BuDRH1e6r9II785q0H3uqeHo X0x1rLuWhFd4xIWTxHo+0v2V4Ocx1AnbaM7fswsTNku2FcjnlrhP5Nyb6QfZe6rKAH3y PRqdthz+zzVz+sBu2goZ35+FrEuT0Hoff4tJRL4adNL1XwufzVM05FdseBo/q1u283y3 rPmrchcTu4ctyF/hTd818GrKiPpaSJ0R3uRw8BIB/Qa+edJMDnjHejliydUrLEWCQjfP oWyQ== X-Forwarded-Encrypted: i=1; AJvYcCWVZUdUVCNqLCIm7e1iQljGWWXALjCFdo7wwyabMg90adBaR4qqWcWA79svM2GaI3RLwNf3bE9LDDbG28z1SHosWMlZN4ER01gg X-Gm-Message-State: AOJu0YwplDlcwoO40VuMLpw6TwAJOze9eg6SH5UBnJNfwZFQ6g2MJd8b aG9NwTK7scN7JhJcD1m9TXzTIkqjHloEL+m69ixct0A1kAY6iPQScMrkX4XawUAPR6hWjbd8kT8 4m1Eis7AZTAryVLbO1B2tmbWhQPKTWQ== X-Received: by 2002:a05:6214:3211:b0:6b0:7f83:adad with SMTP id 6a1803df08f44-6b1a6587bc6mr49572226d6.39.1718274410965; Thu, 13 Jun 2024 03:26:50 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <171815759406.14261.8092450471234028375@noble.neil.brown.name> <20240612071252.GA98398@pevik> In-Reply-To: <20240612071252.GA98398@pevik> From: Amir Goldstein Date: Thu, 13 Jun 2024 13:26:38 +0300 Message-ID: Subject: Re: [LTP] [PATCH] NFS: add atomic_open for NFSv3 to handle O_TRUNC correctly. To: Petr Vorel Cc: NeilBrown , James Clark , linux-nfs@vger.kernel.org, broonie@kernel.org, Aishwarya.TCV@arm.com, ltp@lists.linux.it, Jan Kara Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 12, 2024 at 10:12=E2=80=AFAM Petr Vorel wrote: > > > On Tue, 11 Jun 2024, Amir Goldstein wrote: > > > On Tue, Jun 11, 2024 at 5:30=E2=80=AFAM NeilBrown wro= te: > > > > > On Fri, 07 Jun 2024, James Clark wrote: > > > > > > Hi Neil, > > > > > > Now that your fix is in linux-next the statvfs01 test is passing = again. > > > > > However inotify02 is still failing. > > > > > > This is because the test expects the IN_CREATE and IN_OPEN events= to > > > > > come in that order after calling creat(), but now they are revers= ed. To > > > > > me it seems like it could be a test issue and the test should han= dle > > > > > them in either order? Or maybe there should be a single inotify e= vent > > > > > with both flags set for the atomic open? > > > > > Interesting.... I don't see how any filesystem that uses ->atomic_= open > > > > would get these in the "right" order - and I do think IN_CREATE sho= uld > > > > come before IN_OPEN. > > > > Correct. > > > > > > Does NFSv4 pass this test? > > > > Probably not. > > > > > > IN_OPEN is generated (by fsnotify_open()) when finish_open() is cal= led, > > > > which must be (and is) called by all atomic_open functions. > > > > IN_CREATE is generated (by fsnotify_create()) when open_last_lookup= s() > > > > detects that FMODE_CREATE was set and that happens *after* lookup_o= pen() > > > > is called, which calls atomic_open(). > > > > > For filesystems that don't use atomic_open, the IN_OPEN is generate= d by > > > > the call to do_open() which happens *after* open_last_lookups(), no= t > > > > inside it. > > > > Correct. > > > > > > So the ltp test must already fail for NFSv4, 9p ceph fuse gfs2 ntfs= 3 > > > > overlayfs smb. > > > > > inotify02 does not run on all_filesystems, only on the main test fs, > > > which is not very often one of the above. > > > > This is how I averted the problem in fanotify16 (which does run on > > > all_filesystems): > > > > commit 9062824a70b8da74aa5b1db08710d0018b48072e > > > Author: Amir Goldstein > > > Date: Tue Nov 21 12:52:47 2023 +0200 > > > > fanotify16: Fix test failure on FUSE > > > > Split SAFE_CREAT() into explicit SAFE_MKNOD() and SAFE_OPEN(), > > > because with atomic open (e.g. fuse), SAFE_CREAT() generates FAN_= OPEN > > > before FAN_CREATE (tested with ntfs-3g), which is inconsistent wi= th > > > the order of events expected from other filesystems. > > > > inotify02 should be fixed similarly. > > > Alternately - maybe the kernel should be fixed to always get the order > > right. > > I have a patch. I'll post it separately. > > @Amir, if later Neil's branch get merged, maybe we should use on fanotify= 16 > creat() on the old kernels (as it was in before your fix 9062824a7 ("fano= tify16: > Fix test failure on FUSE")), based on kernel check. > I am hoping that the fix could be backported to v6.9.y and then we won't need to worry about older LTS kernels for fanotify16, because fuse only supports FAN_CREATE since v6.8. Thanks, Amir.