Received: from fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 780AC3491D0; Mon, 1 Jun 2026 07:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.150 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780297270; cv=none; b=LTSwgp3LvuP+468m1Pe0+bcVgpU3XTULTxOHMB7//bBBXNW0kp6xs/vp9G5AM3DqPW0MxAjTt/vDvg1YgABqPPsDpyirZB8ld/afbxrIirhWGPyTmRkmGV2RcNig5Cuo6DhkP1Q/jo6ksgN2Y4xBlyYsJWj8SnjnGrsezBtobrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780297270; c=relaxed/simple; bh=TDc7dh6NNNjKmWGcBvVj58tUBuQZBZ7jsPWv8gEbcxw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rToD3u7au8sebsyEBguXPvvfI0UPbsJqml5dXfAr04brpHiXj/LlX92xOTJ1CtZWcQKuWRRgVhLSGTC1BEGMUysxHPQFqPPhPuxRmEeifpR4KxKqZ5wuiMI56rSWBGoKqxwbsMeLAxvWz41Xbe1MDV0jAY8r20MucTLN8olCQ1Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=P21hQLA+; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=RiOcwnMA; arc=none smtp.client-ip=103.168.172.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="P21hQLA+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="RiOcwnMA" Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id BE0D2EC01FF; Mon, 1 Jun 2026 03:01:08 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Mon, 01 Jun 2026 03:01:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm1; t=1780297268; x=1780383668; bh=HdhnVtmOLibzEPZm8EzezN431iTgWB7oXxS2i/pzZq8=; b= P21hQLA+YiboKZRnbVsEPn7s77NTTDVquf1iZaVDg4SMfzF727uLilvWZz8k3CLO FDSYlmy94e41cAFnPOm8Rk8QMY7Vy7cg6UBB59cKJT4IydQIRZ1I8DfU37s3af4d 5IqHIbMZ/6U/vHMWHZuOWTmlwJsTAUzLj9kN8i8Amdpo3R3fG/WJ1lojbANR2vsH 102pqkWiG98UaO9FfhACuxLLKv8KjMPKDZXXngOu7qYRedMvXpDJ+C6e+i0e7RNJ lf+YgqbVIlEt0oGTjGG+T5Tmag4pCXQB+SSNl/qBsRTBCO5ZR0GrmGZ+ssSIJ+lW 5erMwdNb/4ZCDSnHO5Qkow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1780297268; x=1780383668; bh=H dhnVtmOLibzEPZm8Ezez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Pdp1ai0AXw X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Jun 2026 03:01:05 -0400 (EDT) From: NeilBrown To: Christian Brauner , Alexander Viro , Chuck Lever , Jeff Layton Cc: Jan Kara , linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, "Jori Koolstra" , Benjamin Coddington , "Mateusz Guzik" Subject: [PATCH 02/18] VFS: move delegated_inode retry loop into lookup_open() Date: Mon, 1 Jun 2026 16:37:50 +1000 Message-ID: <20260601070042.249432-3-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260601070042.249432-1-neilb@ownmail.net> References: <20260601070042.249432-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: NeilBrown By moving this retry into lookup_open() we no longer need to pass around the delegated_inode pointer. Various variable assignments need to be moved out of the declaration block so that they can still happen after the goto. Signed-off-by: NeilBrown --- fs/namei.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 998fde251fcf..b00ff3f2faf7 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4403,17 +4403,23 @@ static struct dentry *atomic_open(const struct path *path, struct dentry *dentry * An error code is returned on failure. */ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, - const struct open_flags *op, - struct delegated_inode *delegated_inode) + const struct open_flags *op) { + struct delegated_inode delegated_inode = { }; struct mnt_idmap *idmap; struct dentry *dir = nd->path.dentry; struct inode *dir_inode = dir->d_inode; - int open_flag = op->open_flag; + int open_flag; struct dentry *dentry; - int error, create_error = 0; - umode_t mode = op->mode; - bool got_write = false; + int error, create_error; + umode_t mode; + bool got_write; + +retry: + open_flag = op->open_flag; + got_write = false; + mode = op->mode; + create_error = 0; if (open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) { got_write = !mnt_want_write(nd->path.mnt); @@ -4511,7 +4517,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, /* Negative dentry, just create the file */ if (!dentry->d_inode && (open_flag & O_CREAT)) { /* but break the directory lease first! */ - error = try_break_deleg(dir_inode, LEASE_BREAK_DIR_CREATE, delegated_inode); + error = try_break_deleg(dir_inode, LEASE_BREAK_DIR_CREATE, &delegated_inode); if (error) goto out_dput; @@ -4546,6 +4552,14 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, if (got_write) mnt_drop_write(nd->path.mnt); + if (is_delegated(&delegated_inode)) { + /* Must have come through out_dput */ + error = break_deleg_wait(&delegated_inode); + + if (!error) + goto retry; + } + return dentry; out_dput: @@ -4593,7 +4607,6 @@ static struct dentry *lookup_fast_for_open(struct nameidata *nd, int open_flag) static const char *open_last_lookups(struct nameidata *nd, struct file *file, const struct open_flags *op) { - struct delegated_inode delegated_inode = { }; int open_flag = op->open_flag; struct dentry *dentry; const char *res; @@ -4623,19 +4636,10 @@ static const char *open_last_lookups(struct nameidata *nd, return ERR_PTR(-ECHILD); } } -retry: - dentry = lookup_open(nd, file, op, &delegated_inode); - - if (IS_ERR(dentry)) { - if (is_delegated(&delegated_inode)) { - int error = break_deleg_wait(&delegated_inode); - if (!error) - goto retry; - return ERR_PTR(error); - } + dentry = lookup_open(nd, file, op); + if (IS_ERR(dentry)) return ERR_CAST(dentry); - } if (file->f_mode & (FMODE_OPENED | FMODE_CREATED)) { dput(nd->path.dentry); -- 2.50.0.107.gf914562f5916.dirty