From nobody Sat Oct 4 01:41:02 2025 Received: from neil.brown.name (neil.brown.name [103.29.64.221]) (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 09B9D639; Fri, 22 Aug 2025 00:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.29.64.221 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755821482; cv=none; b=O9mIyW6Qet+xfnRMAsriwttxfk6psrt5cVJc8Umr6XZa8FjJFIyiMJ6AEq+TuravP6FZ7tIsPMY8FjXEKQzcJBJN/9E3hLyO7QBFuIgTmG0i6MZSeS8z7MSr1psnbF1j5nS2xuyIeKm7ZUUGxW+VhYauIDuQ9wH4LOjx0ch08b0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755821482; c=relaxed/simple; bh=Wv73anJ/o0Drj+xc9I6pO/lz+Q65M5okLbn7MxX1YzE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=StfYszPxgvJkNJdkWUzVE2Oy90Yd0xnkAujAjsKK85UJa3EwscRuJaHUBp0uTh3J0jQ5KA6Aq0Cxhjex9DpEehChZIbH8cWUkZpgbedvS4SqEvo4R6mGuJPd1UdoZMgi+tQ25sLmf5GyYKv8NdaYOZxVjb1wRDgUbqMEyyaXkO4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=brown.name; spf=pass smtp.mailfrom=neil.brown.name; arc=none smtp.client-ip=103.29.64.221 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=brown.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=neil.brown.name Received: from 196.186.233.220.static.exetel.com.au ([220.233.186.196] helo=home.neil.brown.name) by neil.brown.name with esmtp (Exim 4.95) (envelope-from ) id 1upFN8-006naZ-2A; Fri, 22 Aug 2025 00:11:11 +0000 From: NeilBrown To: Alexander Viro , Christian Brauner Cc: Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/16] VFS: discard err2 in filename_create() Date: Fri, 22 Aug 2025 10:00:19 +1000 Message-ID: <20250822000818.1086550-2-neil@brown.name> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20250822000818.1086550-1-neil@brown.name> References: <20250822000818.1086550-1-neil@brown.name> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since 204a575e91f3 "VFS: add common error checks to lookup_one_qstr_excl()" filename_create() does not need to stash the error value from mnt_want_writ= e() into a separate variable - the logic that used to clobber 'error' after the call of mnt_want_write() has migrated into lookup_one_qstr_excl(). So there is no need for two different err variables. This patch discards "err2" and uses "error' throughout. Signed-off-by: NeilBrown --- fs/namei.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index cd43ff89fbaa..62c1e2268942 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4114,7 +4114,6 @@ static struct dentry *filename_create(int dfd, struct= filename *name, unsigned int reval_flag =3D lookup_flags & LOOKUP_REVAL; unsigned int create_flags =3D LOOKUP_CREATE | LOOKUP_EXCL; int type; - int err2; int error; =20 error =3D filename_parentat(dfd, name, reval_flag, path, &last, &type); @@ -4129,7 +4128,7 @@ static struct dentry *filename_create(int dfd, struct= filename *name, goto out; =20 /* don't fail immediately if it's r/o, at least try to report other error= s */ - err2 =3D mnt_want_write(path->mnt); + error =3D mnt_want_write(path->mnt); /* * Do the final lookup. Suppress 'create' if there is a trailing * '/', and a directory wasn't requested. @@ -4142,17 +4141,16 @@ static struct dentry *filename_create(int dfd, stru= ct filename *name, if (IS_ERR(dentry)) goto unlock; =20 - if (unlikely(err2)) { - error =3D err2; + if (unlikely(error)) goto fail; - } + return dentry; fail: dput(dentry); dentry =3D ERR_PTR(error); unlock: inode_unlock(path->dentry->d_inode); - if (!err2) + if (!error) mnt_drop_write(path->mnt); out: path_put(path); --=20 2.50.0.107.gf914562f5916.dirty