Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp262298lqp; Wed, 12 Jun 2024 00:10:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWEGLXepIXYxW9HEqoYaR1eNc+TdZ1pqH4iEzEjFdz5/eD7K2t/wodj3hBYI7fUoCGFDAPfQXuKT0GdnmjvfmHmI5IZZCo/d3S4Tljpg== X-Google-Smtp-Source: AGHT+IHmGXzKGY89ujF9ERwFBnTN46EAbTl6XGFX129f9iNM+XKg12GONra+q4+co+OE6ZHMLszL X-Received: by 2002:a17:906:6a02:b0:a5a:1562:518c with SMTP id a640c23a62f3a-a6f47d56e31mr68251966b.48.1718176207856; Wed, 12 Jun 2024 00:10:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718176207; cv=pass; d=google.com; s=arc-20160816; b=kBAYIkVwishwYsTFOTX+cOdveQdUpVxdPCXb1VFbiL3UNZqJbpJv3gLDQkntUxGcwG K31t9DZT8ZOsz2gAhb7fVrKB2KMm2CiIgG8KndjZGp6xwPMk2/LjlBCwoSquNMBbmA4n FhpiB4SBhZczZS/NJ3hWCjgrUDeYdHHCNfKg39VLg0ntpPENR9KkHO5/rx7tVBvfpMT0 SybYFOg5sovgZDXcRvtSUNE5x/Wyh9VM4oQRXrN1+dvcwib/J4IENjIjIAzJ3TlJUZiT SzE0ZCKefbvBsVr98XrP5v+2Jteqya5M3k0XQugJ5rDyhpR5LpbW7gMOG8ZIaW4Si2kb vizg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:references:in-reply-to:subject:cc:to:from :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=XA6suEtJ1Wm6DTNcti+lUkN3qJPn424kTR0RHITUBCY=; fh=XM85XiObgjvAgItKJ2+VkUO01jYc7z7c6IVY/byK5L8=; b=IcgwJcOww+Eu8y0MEgb+EXcNG6bQLhXlLso5aMGWQ6YREV6hHOPIN/tmmE7b0FjtBW XGb4lHBcsu1OYM1VZp4gWf9fLdGP+x7dpEJnSdQUxzm+gVNWOa1aRpeJCl4tfMoerXzv pnhL+2dVqRMuOCRvictX6pftryYyQEKUGjaZ8dD6WQFFqV7JF0qByI5C4jZ2jAx6pZCd PyRuUaJY0oxYUf+yPcF5iamGq5fhYpafJI8KEQqE7L7pbZIvlKnlHJPk6ZBc84BpBr7F AihfEFNriWcTIsbYjZqKmlXH/TQWWc3LD8N6v+uAIKSs9vUXAGbIMnlzdQuICKmosLmk MtmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="aHEfu/9I"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="HntaK/XD"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="aHEfu/9I"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-nfs+bounces-3689-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f29982103si213583666b.630.2024.06.12.00.10.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 00:10:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3689-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="aHEfu/9I"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="HntaK/XD"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="aHEfu/9I"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-nfs+bounces-3689-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 64B6C1F211F7 for ; Wed, 12 Jun 2024 07:10:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D791167270; Wed, 12 Jun 2024 07:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="aHEfu/9I"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="HntaK/XD"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="aHEfu/9I"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="HntaK/XD" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 69E6F12DD9B; Wed, 12 Jun 2024 07:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718176144; cv=none; b=HQ0Op52gncfSRvFV7Aw6s5mdmZAurZ2eiPLoqKY0NjnmTYkejt0B8xsDfHcxvnxa8XJw1TbOY+Uqftm8HZODtnbJq3j5QqqdXB1Dhd7Ftx1OH6vZD7Hr9EDxnuXzGs2uAuDk0D8TYNplUFZy70AhDaxp1r98Ea/O9yJu9QAvQOI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718176144; c=relaxed/simple; bh=cVu2TbN1bt8mwrJse0j92Z1I9fU2mSvB26dJ8/ydGOE=; h=Content-Type:MIME-Version:From:To:Cc:Subject:In-reply-to: References:Date:Message-id; b=Y7HfelFTTdw6+iq2UW9hydCpXmrYx9oC+z9fktup697BkGKwUWUi4Dq7zF4xNG9PLmP/0oLztdYOWOB3nJX8Gb0zjJ8y5VWUE1zyIVSKpzTo/ftfMfblAuKxZqrwaWCbwsvMVymeogOqIOxPEA3CmCVXvXkxjr/brcFVvC5Ce4o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=aHEfu/9I; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=HntaK/XD; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=aHEfu/9I; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=HntaK/XD; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 88FAA5BCFB; Wed, 12 Jun 2024 07:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718176141; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XA6suEtJ1Wm6DTNcti+lUkN3qJPn424kTR0RHITUBCY=; b=aHEfu/9IM5Sw0UcPbnPtFScAmNS7/gxRq8y210X3UCVRfm+e5nFQR08yUoLcV5hd0K1E6t SUEogeiGMAmot87StL5zU+QHU/RgNTWNXv4HPXOqbKtfrl5qgJJW8Vbypk/Dy5oORTw+sj GYNtDHy5oXL69JVT1clfgXES79rb2aQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718176141; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XA6suEtJ1Wm6DTNcti+lUkN3qJPn424kTR0RHITUBCY=; b=HntaK/XD3nY2iLQWy9DJ3O1MRlPRTKTqhereJg0jBlyTNfW9PnJmt8RhSHT/47IW1ANDZk JgypLnQlpNmQKBBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="aHEfu/9I"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="HntaK/XD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718176141; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XA6suEtJ1Wm6DTNcti+lUkN3qJPn424kTR0RHITUBCY=; b=aHEfu/9IM5Sw0UcPbnPtFScAmNS7/gxRq8y210X3UCVRfm+e5nFQR08yUoLcV5hd0K1E6t SUEogeiGMAmot87StL5zU+QHU/RgNTWNXv4HPXOqbKtfrl5qgJJW8Vbypk/Dy5oORTw+sj GYNtDHy5oXL69JVT1clfgXES79rb2aQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718176141; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XA6suEtJ1Wm6DTNcti+lUkN3qJPn424kTR0RHITUBCY=; b=HntaK/XD3nY2iLQWy9DJ3O1MRlPRTKTqhereJg0jBlyTNfW9PnJmt8RhSHT/47IW1ANDZk JgypLnQlpNmQKBBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CB73B137DF; Wed, 12 Jun 2024 07:08:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 03rTG4lJaWaxRAAAD6G6ig (envelope-from ); Wed, 12 Jun 2024 07:08:57 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "NeilBrown" To: "Al Viro" Cc: "Christian Brauner" , "Jan Kara" , "Amir Goldstein" , "James Clark" , ltp@lists.linux.it, linux-nfs@vger.kernel.org, "LKML" , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] VFS: generate FS_CREATE before FS_OPEN when ->atomic_open used. In-reply-to: <20240612031404.GH1629371@ZenIV> References: <>, <20240612031404.GH1629371@ZenIV> Date: Wed, 12 Jun 2024 17:08:53 +1000 Message-id: <171817613375.14261.11854641862108370837@noble.neil.brown.name> X-Rspamd-Queue-Id: 88FAA5BCFB X-Spam-Score: -4.51 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[kernel.org,suse.cz,gmail.com,arm.com,lists.linux.it,vger.kernel.org]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_SEVEN(0.00)[9]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org On Wed, 12 Jun 2024, Al Viro wrote: > On Wed, Jun 12, 2024 at 12:55:40PM +1000, NeilBrown wrote: > > > IF we don't care about that, we might as well take fsnotify_open() > > > out of vfs_open() and, for do_open()/do_tmpfile()/do_o_path(), into > > > path_openat() itself. I mean, having > > > if (likely(!error)) { > > > if (likely(file->f_mode & FMODE_OPENED)) { > > > fsnotify_open(file); > > > return file; > > > } > > > in there would be a lot easier to follow... It would lose fsnotify_ope= n() > > > in a few more failure exits, but if we don't give a damn about having it > > > paired with fsnotify_close()... > > >=20 > >=20 > > Should we have fsnotify_open() set a new ->f_mode flag, and > > fsnotify_close() abort if it isn't set (and clear it if it is)? > > Then we would be guaranteed a balance - which does seem like a good > > idea. >=20 > Umm... In that case, I would rather have FMODE_NONOTIFY set just before > the fput() in path_openat() - no need to grab another flag from ->f_mode > (not a lot of unused ones there) and no need to add any overhead on > the fast path. >=20 Unfortunately that gets messy if handle_truncate() fails. We would need to delay the fsnotify_open() until after truncate which means moving it out of vfs_open() or maybe calling do_dentry_open() directly from do_open() - neither of which I like. I think it is best to stick with "if FMODE_OPENED is set, then we call fsnotify_open() even if the open will fail", and only move the place where fsnotify_open() is called. BTW I was wrong about gfs. Closer inspection of the code show that finish_open() is only called in the ->atomic_open case. Thanks, NeilBrown