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 49496347BBD; Mon, 1 Jun 2026 07:02:12 +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=1780297333; cv=none; b=XZxTdFNqRKyIN45hikxnxQHCuWzopgQgR5wp5MbTqwOF0j7B+Q+TChLwKQj3hb3FY5Rh2cGRSgOUAfflmxRPu1ETNRTb87OG0ZLn6rGFVh/ek2pJ1/1zgBdoFfeXP6oBhbFyArs1jedMLzENGXENvlhotfqjtM9cFwVxINH++0o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780297333; c=relaxed/simple; bh=c0oU/lyCCFA/wAV0w7iVIy2K09e+ih8+n1e01J1+7uQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TIhqzzd+6izEBslnuOUWcfD0nuSWBk/k6A0OqAyNrvhYzD635bdhRzEZqKQDls11j2p3hYlpptuJ16exKqr/doJmMnlKCAjspls7E4dUV5pQLoS2ELoZiC2TaYeaFgWuK4Fy1Dakst32sWtCMsN4nniTt7kqnyty1dXQrb0W7bE= 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=KeRg0/E8; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ksks0v8a; 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="KeRg0/E8"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ksks0v8a" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 92A2DEC0064; Mon, 1 Jun 2026 03:02:11 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Mon, 01 Jun 2026 03:02:11 -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=1780297331; x=1780383731; bh=O4WMb2YgUoourN6IkOvHqZeXaKDvIpyfKljNaUFNSgg=; b= KeRg0/E8/V+WT5qNZnqeN268QPAfDII3dMJ9WZRf/Jqd4wH9iC9GgDaJDoQO7r1m KGxonyI3TGzZs8XlXQDHXcKclSF7Fqi1VhNJEDy7yzgw9eBM/6QTNqOAkih4koBC fHS40Vn8yUu/bt8jaYPSHLKl/yU8Y/T/LxARQPMDA1nfYN5m3b2Qq6nf0Nn6jVpk +yeF8wCNjwLtfhgbwD/189f8ZH46oNGOJVvzG+9E+8CG2SfBj03HBHLu6ZGUDk0U JsNlEI+/FPjGiYEAVDag+mj/quYZcWkw3YIxHXixFo1b/wDPeorT7WDHF6UZcVFY DfcWUHNQec8zvq5sPzsvNg== 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=1780297331; x=1780383731; bh=O 4WMb2YgUoourN6IkOvHqZeXaKDvI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3t5bhLFQ/C28SGa7jpLZtUiOTjpOhoY7fA X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Jun 2026 03:02:08 -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 14/18] nfsd: move some code out of the d_really_is_negative() branch in nfsd4_create_file() Date: Mon, 1 Jun 2026 16:38:02 +1000 Message-ID: <20260601070042.249432-15-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 The benefit of this code movement isn't immediately obvious, but it will make it easier to switch to using lookup_open(). Signed-off-by: NeilBrown --- fs/nfsd/nfs4proc.c | 49 ++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 6a564f1dc2f8..03eb93f696f9 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -218,7 +218,11 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, .na_iattr = iap, .na_seclabel = &open->op_label, }; + int oflags = O_CREAT | O_LARGEFILE; struct dentry *parent, *child = ERR_PTR(-EINVAL); + struct path path = { + .mnt = fhp->fh_export->ex_path.mnt, + }; __u32 v_mtime, v_atime; struct inode *inode; __be32 status; @@ -283,6 +287,19 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, iap->ia_atime.tv_sec = v_atime; iap->ia_mtime.tv_nsec = 0; iap->ia_atime.tv_nsec = 0; + + oflags |= O_EXCL; + } + + switch (open->op_share_access & NFS4_SHARE_ACCESS_BOTH) { + case NFS4_SHARE_ACCESS_WRITE: + oflags |= O_WRONLY; + break; + case NFS4_SHARE_ACCESS_BOTH: + oflags |= O_RDWR; + break; + default: + oflags |= O_RDONLY; } host_err = fh_want_write(fhp); @@ -295,40 +312,20 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, status = nfserrno(PTR_ERR(child)); goto out; } + path.dentry = child; if (d_really_is_negative(child)) { - struct file *filp; - struct path path; - int oflags; - - oflags = O_CREAT | O_LARGEFILE; - if (nfsd4_create_is_exclusive(open->op_createmode)) - oflags |= O_EXCL; - - switch (open->op_share_access & NFS4_SHARE_ACCESS_BOTH) { - case NFS4_SHARE_ACCESS_WRITE: - oflags |= O_WRONLY; - break; - case NFS4_SHARE_ACCESS_BOTH: - oflags |= O_RDWR; - break; - default: - oflags |= O_RDONLY; - } - - path.mnt = fhp->fh_export->ex_path.mnt; - path.dentry = child; - filp = dentry_create(&path, oflags, open->op_iattr.ia_mode, - current_cred()); + open->op_filp = dentry_create(&path, oflags, open->op_iattr.ia_mode, + current_cred()); child = path.dentry; - if (IS_ERR(filp)) { + if (IS_ERR(open->op_filp)) { end_creating(child); - status = nfserrno(PTR_ERR(filp)); + status = nfserrno(PTR_ERR(open->op_filp)); + open->op_filp = NULL; goto out; } - open->op_filp = filp; open->op_created = open->op_filp->f_mode & FMODE_CREATED; } end_creating(child); -- 2.50.0.107.gf914562f5916.dirty