Received: from fhigh-a5-smtp.messagingengine.com (fhigh-a5-smtp.messagingengine.com [103.168.172.156]) (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 EC19E33121C; Mon, 1 Jun 2026 07:02:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.156 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780297323; cv=none; b=KR7wjeYqlRhF9+s3xcBcdndHm8JIvuR+gX9R5qzRtHdAqDOPuuQ0U4EV47YAyu8qRMfkDvmOPqpaV0Cb4zONNTYufKXgok78+NVVINcfNyB+SrAElr26eLazfjqZpB2Id8UFQegHzPpJn1BUZEnL9adMue+D8JRQs4sIwRFVuwg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780297323; c=relaxed/simple; bh=hw9uFLRSP8vw9pKfd32CXObDAjRCYvSFKNlT8DDIc/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cC0qBQnofJogZYRo5fgbruSbj3799NbnWIq2WsqOhzKWdpEnz+5YA4mnUIe4Lf1VpiTqfu2DWELjkQW0a1Cr3N6QMf4HNsR4blyQ9xq5GwVc4JLJy4lbFpRCaXLSbjCkuifhZ0eXn6bgukANTHUaZ8tZ7jalEWuO36g7Stcu3dc= 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=eG34/sQR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=F821Yp4n; arc=none smtp.client-ip=103.168.172.156 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="eG34/sQR"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="F821Yp4n" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2CCFF1400091; Mon, 1 Jun 2026 03:02:01 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Mon, 01 Jun 2026 03:02:01 -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=1780297321; x=1780383721; bh=zF3q9lU86h5i4fcI3oBMJ4u9X9o+WVvn+cp2yyYekH4=; b= eG34/sQRK3BtcXO/Bh3YP4hmpLmNfhNTlB8Jqzqiu/wxVkJ/Jfe4Xr4MSLAjS/le 3J5OvzTT3jJXCgQJxTjBTC6qOeoMcIf4jRVRpY1Mtlcdyp0q4d5FdzQo1lg1B3Pk t7PWCJ4gDdDr/Xy5znX/O1R5mTVAU5KHqB/7wvOtpycFTbZNsGEnW6hniY2emqte HGDuXfCzzS3EiiUpUVKQsRQAr97FVy8R2df+s5veh/vWKwg0ZVXlwTzuqXRd/jbd OPLfVvPsJ0JPJzJZaGioJrlrf7LwBoiPsjBTASbVmBkPrv4Oj2GNg+Hrs9NxhJFW I31KqESfsIYwrYeuwwjwQA== 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=1780297321; x=1780383721; bh=z F3q9lU86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mwaaeVT9cFgxyk+4Lm4635nEJhC6k5ieHs83FtQ X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Jun 2026 03:01:57 -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 12/18] nfsd: reduce range of directory lock in nfsd4_create_file() Date: Mon, 1 Jun 2026 16:38:00 +1000 Message-ID: <20260601070042.249432-13-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 We only need to hold the lock taken by start_creating() until the create has been attempted. Holding for longer can serve no purpose. The lock is currently held across the setattr call. This might be the intent but it serves no purpose. Holding the lock prevents the name from being removed or renamed, but it doesn't prevent a GETATTR or a racing SETATTR or an OPEN. Signed-off-by: NeilBrown --- fs/nfsd/nfs4proc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 65447b964733..c4d874b9aab5 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -333,10 +333,11 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, if (d_really_is_negative(child)) { status = nfsd4_vfs_create(fhp, &child, open); - if (status != nfs_ok) - goto out; open->op_created = open->op_filp->f_mode & FMODE_CREATED; } + end_creating(child); + if (status != nfs_ok) + goto out; status = fh_compose(resfhp, fhp->fh_export, child, fhp); if (status != nfs_ok) @@ -387,7 +388,6 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, open->op_bmval[2] &= ~FATTR4_WORD2_POSIX_ACCESS_ACL; } out: - end_creating(child); nfsd_attrs_free(&attrs); fh_drop_write(fhp); return status; -- 2.50.0.107.gf914562f5916.dirty