From patchwork Wed Dec 20 05:15:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499509 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 B190D11CBA for ; Wed, 20 Dec 2023 05:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="VfndUN7C" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EgM2mQaY0aQjWB70iwIkzzbiktHBx51K37kw/owBbgg=; b=VfndUN7CzBZVi+0uZwVX2Q31ck GL6yQq1gyS9vYrLB04ZZZ1fRzYBsuabY/WlhhhLLVFOYZhX6pezGjFCe/F918/T+twkCxAOvfCG1D 1WVFpdU9vMtxUm9yJLKYZoNDVzRYoGMSG+0aW05UhlT0hzEMdMoLLSJZSsxJAGi4Iz5udJ4E0swfA UNm2wXIsl24TmNCZKZO7Ze+ejRquRWVtBCIjk/2VxHYgKrGdoTgxZNkjaOjU2a2zJswJQdaYoyspE MUDkWRPnms7gVwkUUtUFf3KH6CwcTpDUSMyselUNmt6Iz9evL1BmVHY6C0LSXEtOBpeyB0psPTJrJ /zTdI8pw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFovb-00HISt-32; Wed, 20 Dec 2023 05:15:32 +0000 Date: Wed, 20 Dec 2023 05:15:31 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Richard Weinberger Subject: PATCH 01/22] hostfs: use d_splice_alias() calling conventions to simplify failure exits Message-ID: <20231220051531.GZ1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro --- fs/hostfs/hostfs_kern.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index ea87f24c6c3f..a73d27c4dd58 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -637,12 +637,8 @@ static struct dentry *hostfs_lookup(struct inode *ino, struct dentry *dentry, inode = hostfs_iget(ino->i_sb, name); __putname(name); - if (IS_ERR(inode)) { - if (PTR_ERR(inode) == -ENOENT) - inode = NULL; - else - return ERR_CAST(inode); - } + if (inode == ERR_PTR(-ENOENT)) + inode = NULL; return d_splice_alias(inode, dentry); } From patchwork Wed Dec 20 05:16:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499510 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 A5E8EFBE1 for ; Wed, 20 Dec 2023 05:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="KQ6/Dfrv" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=oGoJfhgfYqH1rbfIK0HfvLkdO9o5OYoUPJPVPgQwoLg=; b=KQ6/Dfrv8Tefj1bhlsge7FGvg2 bbPwQnR9vHaA24NM+vKB7EU3nGGe6TSc99zpctwrCb1evoO5YsVtiCTRzT9wo+q5BGvJkusrn7HkW pqBT4GpQZYzEFYTi/Lca/A94m5boE1kLljch9MZDhxouezo/KZY/XzxCdnbpywGxpsf0pB9JNP07N iretzVphirxvCGFd2OKatCBPzHogRLVczTjeihXRKlykvCxjU44QuHO59ZBnPQZz5rrsntcHteHND YQ334ymg2m3QCwiX2AvnLvNveI1GnY/V+cSVGX/x2/VHTWoyKKZYuXo8f6BrMY3E7DYdgI2yFF0us f8XRm04g==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFowp-00HIXN-17; Wed, 20 Dec 2023 05:16:47 +0000 Date: Wed, 20 Dec 2023 05:16:47 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Luis Chamberlain , Kees Cook Subject: [PATCH 02/22] /proc/sys: use d_splice_alias() calling conventions to simplify failure exits Message-ID: <20231220051647.GA1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro --- fs/proc/proc_sysctl.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 8064ea76f80b..1ae6486dc7d4 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -534,13 +534,8 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, goto out; } - inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); - if (IS_ERR(inode)) { - err = ERR_CAST(inode); - goto out; - } - d_set_d_op(dentry, &proc_sys_dentry_operations); + inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); err = d_splice_alias(inode, dentry); out: @@ -698,13 +693,8 @@ static bool proc_sys_fill_cache(struct file *file, return false; if (d_in_lookup(child)) { struct dentry *res; - inode = proc_sys_make_inode(dir->d_sb, head, table); - if (IS_ERR(inode)) { - d_lookup_done(child); - dput(child); - return false; - } d_set_d_op(child, &proc_sys_dentry_operations); + inode = proc_sys_make_inode(dir->d_sb, head, table); res = d_splice_alias(inode, child); d_lookup_done(child); if (unlikely(res)) { From patchwork Wed Dec 20 05:17:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499511 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 A3F6F11715 for ; Wed, 20 Dec 2023 05:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="Y2vTe1tD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=MsN7mdifMIkNNxSN2uZM3fK+ue2whEnwIYaU5Z/NpkE=; b=Y2vTe1tDcRH940KeCZOJdUm2YJ uITizmgdZ04+eBpe762yofA9kfaD14q/Iy5lbqVIVaLbCb0VZqUIII8Hi+wl1CoTtrvGJOxDqVZcY E5KDI8U+bDE81obrINM++EqVUKRi4ZzBgN04gdp9fw2L//MLI6a/VMtKqsdvFnQX6ejVNJb4HE1g6 5y+y8f5VcafkPeNQCjXpWWpO1EC8xv+6UiSIwRU7/8IJ6StcblvZhswzrguMBN22NE6388YE3ubgo alAsNxh5Tr1/yBX2I8N+TwHoanpxkKODhxgo3terjhPPsE2DXvxYc7UmVIVjn7NMgQQlbD6GU7rBI ditUdm6w==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFoxc-00HIaX-2Y; Wed, 20 Dec 2023 05:17:37 +0000 Date: Wed, 20 Dec 2023 05:17:36 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Damien Le Moal Subject: [PATCH 03/22] zonefs: d_splice_alias() will do the right thing on ERR_PTR() inode Message-ID: <20231220051736.GB1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro Acked-by: Damien Le Moal --- fs/zonefs/super.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index e6a75401677d..93971742613a 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -747,8 +747,6 @@ static struct dentry *zonefs_lookup(struct inode *dir, struct dentry *dentry, inode = zonefs_get_dir_inode(dir, dentry); else inode = zonefs_get_file_inode(dir, dentry); - if (IS_ERR(inode)) - return ERR_CAST(inode); return d_splice_alias(inode, dentry); } From patchwork Wed Dec 20 05:18:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499512 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 5A621C8E8 for ; Wed, 20 Dec 2023 05:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="O3R39gDX" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=c+p6aeVDu8lejuTIQ09vWacuxO4n/pJOAHqwSaX86ps=; b=O3R39gDX7X0FbsJWhz92iworaF 0Ex9Gnbq4Nhy3rxxV5doX8yiW8+PhBlUTIghHFa86KibqZ5M+So5klanhAkRlnEVUb6bJKuK6Wcfi om4Va40OivYe/3Ajze2w6jNHMKOABYOTXdfecNXQCF5wymQvjD/hna5+kZZf4tnkzWMmlqS4nKGsN dTrrIb9yhbyjNkcqwpeocy81O1FRtFEztKh6JFFGzaf14SxOTO5uJ9osurfG1r89+QwtKeEcKPLCJ 6s/6R795BxYkgRD+QotsVycezjiQ4YbknzV26+m7wfj+OCuiNNJ7/VsadZZGIXlOg4WRWB/dm4G/G C0gCLuAw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFoyS-00HIdl-1Y; Wed, 20 Dec 2023 05:18:28 +0000 Date: Wed, 20 Dec 2023 05:18:28 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Jan Kara Subject: [PATCH 04/22] udf: d_splice_alias() will do the right thing on ERR_PTR() inode Message-ID: <20231220051828.GC1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro Acked-by: Jan Kara --- fs/udf/namei.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 3508ac484da3..92f25e540430 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -125,8 +125,6 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, udf_fiiter_release(&iter); inode = udf_iget(dir->i_sb, &loc); - if (IS_ERR(inode)) - return ERR_CAST(inode); } return d_splice_alias(inode, dentry); From patchwork Wed Dec 20 05:19:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499513 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 6A6BFFBE1 for ; Wed, 20 Dec 2023 05:19:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="F7vQCM3q" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=C3eSDKiUv5sWs9ASgYM7qzaFLx45n/vgCwoB9oXDBEg=; b=F7vQCM3qeLrA69eSrMjLLzxPCu 5pe5m0qJDJpj7P2azy7ToFkoqrqdLvnPtkgpUT2ObpsP4SgI+frOe7O5KxaGy+/a+/kjMcThkMcVk NF7Hqm6EyhSE7ZhJFRetEh+aT+Fp6TaacUX098Wed8vzYZ+47CrsRevuTQHJK5xi1hqhxJETZW5Vt wHX/PsJNDOPuKUoRxU27JCrVCAtJ6lErQxWXJNKOLTG4QoUzrttpRyszuEzsqvs3oIqMk9VcISEqV 6RK6wcUgYFUb8K4XSUswRmuUheAMP3IZF+ST+BPq+vAvTK6NdNwIoCkeB1uM4XPgDxWPNqZi+SwFk xEnuPPng==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFoz5-00HIgQ-1Z; Wed, 20 Dec 2023 05:19:07 +0000 Date: Wed, 20 Dec 2023 05:19:07 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: David Sterba Subject: [PATCH 05/22] affs: d_obtain_alias(ERR_PTR(...)) will do the right thing Message-ID: <20231220051907.GD1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro --- fs/affs/namei.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/affs/namei.c b/fs/affs/namei.c index d6b9758ee23d..8c154490a2d6 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c @@ -532,9 +532,6 @@ static struct dentry *affs_get_parent(struct dentry *child) parent = affs_iget(child->d_sb, be32_to_cpu(AFFS_TAIL(child->d_sb, bh)->parent)); brelse(bh); - if (IS_ERR(parent)) - return ERR_CAST(parent); - return d_obtain_alias(parent); } From patchwork Wed Dec 20 05:19:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499514 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 8B67811715 for ; Wed, 20 Dec 2023 05:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="Sap3+fEx" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=G/t0DWJZe4VqjD2LvljtQ/eWGuVQA6pGT9VI7qEQcHk=; b=Sap3+fExL4kqUSmXlPiaSmtUiT L2+MrZ6Qkl3btTDwvq2Cn2B3gLcbS/RDnwiOoiKAm3PKlEdhFlPst79GFfO6ZNx9aL2R4BSYhJUTa hD58EOoxfjw0t+NIO844lYfiSaWXzDO9O6J5Y8jCpUJ/v5ETbc5fAtyLk6FREu13dvPQOfc8roMSj 5QsSw9QI1b6gX6xcfPP9YZMOlQKoBc96/SaqnyTfaEHdUOKaRATtAOlcVHe1TbazCzwJcCXKrX21e PB5An5jne5E2LMu5xQ/pfQVoL366nif6fy6GD/ulKp/1tkQR7Srl2c2GbEojT3wyS2cj1kFoFm2Ge E2Zi8ZzQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFozl-00HIjA-1R; Wed, 20 Dec 2023 05:19:49 +0000 Date: Wed, 20 Dec 2023 05:19:49 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Luis de Bethencourt Subject: [PATCH 06/22] befs: d_obtain_alias(ERR_PTR(...)) will do the right thing Message-ID: <20231220051949.GE1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro --- fs/befs/linuxvfs.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index a93d76df8ed8..2b4dda047450 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -671,9 +671,6 @@ static struct dentry *befs_get_parent(struct dentry *child) parent = befs_iget(child->d_sb, (unsigned long)befs_ino->i_parent.start); - if (IS_ERR(parent)) - return ERR_CAST(parent); - return d_obtain_alias(parent); } From patchwork Wed Dec 20 05:20:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499515 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 EA42814F65; Wed, 20 Dec 2023 05:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="BVU4CFKu" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NagWBOwhQpzgItNonYmSZAcEuPBWdXAlV9sGuh4zWX8=; b=BVU4CFKu2Uxp5110zGqtI4v1PL Pdtdum77NyVbqRZNl6rMQUxQ2Zgy5Rmqz2u/wNVsAq7VLd7rVrQQObJAQy6stnS27SoLXBtxZnC5v /PhQYMU/qVyLz6xfjkR/Bvcqp71XIW7SZSdrFJptHRW8WxuCauTwnrJZHlTFWK0bDxOpC6qpl0E// 7SC1Y4oENollcpi123KyC73Zdku8PwP+yeBtVSHnNpOd5n1+QVlhtrybNWiduhNCu6SE0T+iEneV+ FhZqtCAUxKB/X6XKiyQ5ZQ7KYfnNZvO2skK6btFvdR2eo6lecA01FGbxcd1mKHI8CD4fKDFAJ1RaT aGCJnluA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp0o-00HInT-0T; Wed, 20 Dec 2023 05:20:54 +0000 Date: Wed, 20 Dec 2023 05:20:54 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: ceph-devel@vger.kernel.org Subject: [PATCH 07/22] ceph: d_obtain_{alias,root}(ERR_PTR(...)) will do the right thing Message-ID: <20231220052054.GF1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro Reviewed-by: Xiubo Li --- fs/ceph/export.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/ceph/export.c b/fs/ceph/export.c index 726af69d4d62..a79f163ae4ed 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c @@ -286,8 +286,6 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb, doutc(cl, "%llx.%llx parent %llx hash %x err=%d", vino.ino, vino.snap, sfh->parent_ino, sfh->hash, err); } - if (IS_ERR(inode)) - return ERR_CAST(inode); /* see comments in ceph_get_parent() */ return unlinked ? d_obtain_root(inode) : d_obtain_alias(inode); } From patchwork Wed Dec 20 05:21:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499516 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 02A1515ACE; Wed, 20 Dec 2023 05:21:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="FfJ7jFgv" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=putIwnQflJjta+T2v463mXJ/hOjlgxbDyQ8RoAXbdsA=; b=FfJ7jFgvKeJf2ccStd365kiXWf ulj35oalD983Uys8hWFUZYCYD5OpKrwVt/ao9i66T0Ajc6Whwx1ZcvwW038KTnne5QKL6mQ/ZzW6X hqSotj7tROquYZW+3DMJ9gLyCarcIz6jMGcP4joNkhFu2l6OMOniYQRfWPx1elC5FyYVtBuIZBcCj k/oYwaRRgEv8ie+p1V4eDnvcSq3zHN9Rt/DS6ZQdVKvln9Y8pFZhQygnYT3YjW/6ZLywYEepPN6l6 5lVTvkveNmVDAN12nnzzdfpnMOnG/Ish9XscegacQ6NvaRgC6aDwEy0ODRMAl2Jad1MaeaWnv16id JSey5a5A==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp1c-00HIqK-2E; Wed, 20 Dec 2023 05:21:44 +0000 Date: Wed, 20 Dec 2023 05:21:44 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: gfs2@lists.linux.dev Subject: [PATCH 08/22] gfs2: d_obtain_alias(ERR_PTR(...)) will do the right thing Message-ID: <20231220052144.GG1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro --- fs/gfs2/export.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index cf40895233f5..3334c394ce9c 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c @@ -138,8 +138,6 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, return ERR_PTR(-ESTALE); inode = gfs2_lookup_by_inum(sdp, inum->no_addr, inum->no_formal_ino, GFS2_BLKST_DINODE); - if (IS_ERR(inode)) - return ERR_CAST(inode); return d_obtain_alias(inode); } From patchwork Wed Dec 20 05:22:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499517 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 018B4FBE1 for ; Wed, 20 Dec 2023 05:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="GBoQlPm+" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XIFKQZ720lRS+CHD+TPF/10UZvfKVPTa9e6d2p8Kb0U=; b=GBoQlPm+n5KhHXvtBcR85+SszF NnIyVbGbTE4DEmUUs1+MxQLOqiiT/jtLW/hXO+aWiAPzo7CSs7JePw555Q+vx1wqMvCc33uOOhSiv WqnYG4Ywi3sMnLjYDSbndcD2mTzFDfPVt2O1waazK+0LF4tcRCVD3RCChYnBPaLKPYPwuz9SlMf60 qyLRs3n3FmCiJXPt1a9On2tdFw4F7Ph4W2IzLIUrvgbQygf+Kfieuu07AthP6MtwoAIMMWxSzIO+r JmGqPPx1Ls5MgIth/3j2Y+845PGkGj0jBHXIB9af4BIUNS9C9xat0kOWjlrWAtHnp1szj0bIBjYp2 Nz+lFGBA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp2L-00HIth-2H; Wed, 20 Dec 2023 05:22:29 +0000 Date: Wed, 20 Dec 2023 05:22:29 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Greg Kroah-Hartman Subject: [PATCH 09/22] kernfs: d_obtain_alias(NULL) will do the right thing... Message-ID: <20231220052229.GH1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro --- fs/kernfs/mount.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index 4628edde2e7e..0c93cad0f0ac 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c @@ -125,9 +125,6 @@ static struct dentry *__kernfs_fh_to_dentry(struct super_block *sb, inode = kernfs_get_inode(sb, kn); kernfs_put(kn); - if (!inode) - return ERR_PTR(-ESTALE); - return d_obtain_alias(inode); } From patchwork Wed Dec 20 05:23:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499521 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 98A2511715 for ; Wed, 20 Dec 2023 05:24:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="O/Nuvr/a" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KX/kg4VkkikY4aexK//LcsVLecPvPOPke2DJ/gmuNFI=; b=O/Nuvr/a3Nry8EfRVXgtIVjadC csVXMiOHSIrxs3BHSWT6blAnVSk65Czx84v81lqmma4fRVSeLUWISBw8NrNHmmLQFfAqvO/mk0l58 4jUPs957/q8PB2Ha6D5L+a+aF5SLVFfHJXWrO/JvTU7zEOtsJtCLsm+j2UlrqOi57iQkDg3tJ9BmY 4LKU5/v89LFZ+kNUEkFLBy2JfGY1K3flDhh2bkZ8eVGXHwzXWTJZivsDISTiOM2p3V08Hzr3VdQ/2 n8s3xEnikxm5UdMSHZI4B0HYe2ij/WwQDP0/ckzx89kpvrQIcqDweIPC45+Vq5F8nB0VyTACq6y3h FW0EvuJA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp3n-00HIzY-2P; Wed, 20 Dec 2023 05:24:00 +0000 Date: Wed, 20 Dec 2023 05:23:59 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Jan Kara Subject: [PATCH 11/22] udf: d_obtain_alias(ERR_PTR(...)) will do the right thing... Message-ID: <20231220052359.GJ1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro Acked-by: Jan Kara --- fs/udf/namei.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 92f25e540430..a64102d63781 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -897,7 +897,6 @@ static int udf_rename(struct mnt_idmap *idmap, struct inode *old_dir, static struct dentry *udf_get_parent(struct dentry *child) { struct kernel_lb_addr tloc; - struct inode *inode = NULL; struct udf_fileident_iter iter; int err; @@ -907,11 +906,7 @@ static struct dentry *udf_get_parent(struct dentry *child) tloc = lelb_to_cpu(iter.fi.icb.extLocation); udf_fiiter_release(&iter); - inode = udf_iget(child->d_sb, &tloc); - if (IS_ERR(inode)) - return ERR_CAST(inode); - - return d_obtain_alias(inode); + return d_obtain_alias(udf_iget(child->d_sb, &tloc)); } From patchwork Wed Dec 20 05:24:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499522 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 EBFB0FBE1; Wed, 20 Dec 2023 05:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="VUURBVFN" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=aTxmIqx/EoO7e4qwLoDzfnPzeeP6f7RKMsj+EAXwCHw=; b=VUURBVFNhoRoFNjjPWTrrTYZbW AB2yGrBEFYB/GI8AwFJyn1tXiF2BhV2WFNoZB937NoPsei5LH2J+qrAPVsHgm2lU3wyeWUIsomBni sbQCvyMwY4Zzx5vYhyG5I+ajcAzabRqzZ9PhDUYrgibJ8k3krKi+doUN+4dTc1iTQVPKabst8io9E PtOKI/0vjbtp0KDSJdQqi78pXdMuWRc0sCHb2z2x8JcJ5G+O3RGfAW0SUjhdVkV2pSljyj15ZY+Dt yvXXVz1AncI7vi18pnNFH/ZZ5g72l4Dzcm0xr19IWvMLe3Dd2MJsMPJXJvxe392BYC8BIBmJZnfYW 8s07tEOg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp4h-00HJ4N-03; Wed, 20 Dec 2023 05:24:55 +0000 Date: Wed, 20 Dec 2023 05:24:54 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Theodore Ts'o , linux-ext4@vger.kernel.org Subject: [PATCH 12/22] ext4_add_entry(): ->d_name.len is never 0 Message-ID: <20231220052454.GK1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro That bogosity goes back to the initial merge of ext3. Once upon a time ext2 used to have a similar check; that got taken out during the switch to page cache (June 2001). ext3 got merged into mainline 5 months later, still using buffer cache for directories; removal of the pointless check in ext2 should've been done as a separate patch, but it hadn't been, so that thing got missed... Signed-off-by: Al Viro --- fs/ext4/namei.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index d252935f9c8a..fa8b8dd841b5 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2388,8 +2388,6 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, sb = dir->i_sb; blocksize = sb->s_blocksize; - if (!dentry->d_name.len) - return -EINVAL; if (fscrypt_is_nokey_name(dentry)) return -ENOKEY; From patchwork Wed Dec 20 05:25:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499523 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 25316CA41 for ; Wed, 20 Dec 2023 05:25:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="XiEp+VQT" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=naGbgEwPmhlREwG0QtHCyePUhb8k3nSlMHrLIeAahoU=; b=XiEp+VQT/iAVSYwB6zmpYcPLMu 1NwmlXQ+6kie7mS0s59Qb3W5X2iQ9F+i2KjLx5L42FO5lZC77nMFqBjnLcTZ6d0TDGIPvPox8NFFG sFSf20+twLx9ARYlgzvVY4nbbgQiJHk+wt8PZRYkuWR1IdYbdGU9HNWb7lOUov7g8jbwfMNyqPzio rHjzSHV88bgdOL8wy4pyxjbvuGzfbQNoEXagsQcNFEPs0whfvMXzUHtEoevX5Y6abNWrMRY9RDR61 xOFoS0GLJGc5u4dgWJka0vFnMuiE+GJ04oCfRFbxNmpa86K/vcnK7dr6lie0rk15vFkTTKkkp039p Rd4xUgBg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp5M-00HJ8S-1W; Wed, 20 Dec 2023 05:25:36 +0000 Date: Wed, 20 Dec 2023 05:25:36 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: "Tigran A. Aivazian" Subject: [PATCH 13/22] bfs_add_entry(): get rid of pointless ->d_name.len checks Message-ID: <20231220052536.GL1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro First of all, any dentry getting here would have passed bfs_lookup(), so it it passed ENAMETOOLONG check there, there's no need to repeat it. And we are not going to get dentries with zero name length - that check ultimately comes from ext2 and it's as pointless here as it used to be there. Signed-off-by: Al Viro --- fs/bfs/dir.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index fbc4ae80a4b2..c375e22c4c0c 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c @@ -275,11 +275,6 @@ static int bfs_add_entry(struct inode *dir, const struct qstr *child, int ino) dprintf("name=%s, namelen=%d\n", name, namelen); - if (!namelen) - return -ENOENT; - if (namelen > BFS_NAMELEN) - return -ENAMETOOLONG; - sblock = BFS_I(dir)->i_sblock; eblock = BFS_I(dir)->i_eblock; for (block = sblock; block <= eblock; block++) { From patchwork Wed Dec 20 05:26:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499524 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 1798DCA47; Wed, 20 Dec 2023 05:26:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="HDFtu6yu" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=duE4g5Ia2UG16LD2iQr91EPGHVpyuW2l4XuSdK8kuqQ=; b=HDFtu6yuFHkNPvIAjEE71Wjv2e NfXTza8VpIokRxipJV1PMES/LsoKt9+MooDUnHOuiMDloPzrN5v4rhbY27Pv23W9dexx8LWbNKJTm bli+odXTQk3b+lb2S/pxT1h1DcQczVabTOF9mpM/sJtAq/GdRBGOeyT23R0IdRa1pJ7Hb58sL1BFN YanO2ZhVurVrq05Agir2ogIS5sG6cYy97P3vQDeJWaIEk/K0xXjRfZ2TFkg9/luGj4s88EriAq4Kd Oze4C+qZaOup21uyvj6no7Q+z1FU8EQR3Zw8zZzFw/Ic3sN+q+KFEZXhOuJnXmK35Sir/HquW1o/n ze+IWVhQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp6M-00HJE1-39; Wed, 20 Dec 2023 05:26:39 +0000 Date: Wed, 20 Dec 2023 05:26:38 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: ocfs2-devel@lists.linux.dev Subject: [PATCH 14/22] __ocfs2_add_entry(), ocfs2_prepare_dir_for_insert(): namelen checks Message-ID: <20231220052638.GM1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro namelen can't be zero; neither when it's coming from dentry name, nor when dealing with orphans (in ocfs2_orphan_add() and __ocfs2_prepare_orphan_dir()). Rudiment of old ext2 pointless check, long gone in ext2 itself... Signed-off-by: Al Viro --- fs/ocfs2/dir.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index a14c8fee6ee5..d620d4c53c6f 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -1593,9 +1593,6 @@ int __ocfs2_add_entry(handle_t *handle, struct buffer_head *insert_bh = lookup->dl_leaf_bh; char *data_start = insert_bh->b_data; - if (!namelen) - return -EINVAL; - if (ocfs2_dir_indexed(dir)) { struct buffer_head *bh; @@ -4245,12 +4242,6 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb, trace_ocfs2_prepare_dir_for_insert( (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen); - if (!namelen) { - ret = -EINVAL; - mlog_errno(ret); - goto out; - } - /* * Do this up front to reduce confusion. * From patchwork Wed Dec 20 05:27:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499526 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 0FAA9DDC6; Wed, 20 Dec 2023 05:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="Kydx1Amz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=MKbXRaLjiBc1kAHTStOXxlXCDpKMYpV44rac/unVwhM=; b=Kydx1AmzbnGZcl9uMOWlWoingO jTdF88DJvYRufhXaxmBMv5YFwuEwIlkWw2V9dAnRORk5XnWkM8vqS1lQi8cs1+JjwcTzVyMvj6jIH 8zEcAB9mSwlQILmnpGCEs/PO4PtYgNAAwzJXpCzxpuuyDEYJzP1qcbQNJUyKe7VNEr6zTCeDkXBc2 LLa7muC547oQm5e4RQd8XQqXieyZuUcibev02sYcoTPZRjDqnAXaIeWVnL0PFOImVfN3zaeBHFcJK aQmwXC3DAGSO9eKRatWt7yRAtQ3wFihXc/CtHw03Gy1FkcvGsOTkZal6F6wx6eSkFhlQd5eKcB3fY Bvu7Q7pg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp7O-00HJJZ-1W; Wed, 20 Dec 2023 05:27:42 +0000 Date: Wed, 20 Dec 2023 05:27:42 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: reiserfs-devel@vger.kernel.org Subject: [PATCH 15/22] reiserfs_add_entry(): get rid of pointless namelen checks Message-ID: <20231220052742.GN1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro In all cases namelen is ->d_name.len of some dentry; moreover, a dentry that has passed ->lookup() without triggering ENAMETOOLONG check there. The comment next to these checks is either a rudiment of some other check that used to be there once upon a time, or an attempt to come up with the possible reason for that check (well, more like "why does ext3 do it?") Signed-off-by: Al Viro --- fs/reiserfs/namei.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 994d6e6995ab..c5f233b4a27f 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c @@ -451,13 +451,6 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th, BUG_ON(!th->t_trans_id); - /* cannot allow items to be added into a busy deleted directory */ - if (!namelen) - return -EINVAL; - - if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize)) - return -ENAMETOOLONG; - /* each entry has unique key. compose it */ make_cpu_key(&entry_key, dir, get_third_component(dir->i_sb, name, namelen), From patchwork Wed Dec 20 05:28:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499527 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 ABF71168A4 for ; Wed, 20 Dec 2023 05:28:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="u3UH+mNf" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=MP81gFD/vO0Nfz/TqR7yHb+uaoSWgIHgeqI6XASg6Go=; b=u3UH+mNf9TetfTbZKupC8TEwJP x+cPChEEuxW/Nkby2ac7WWnu8p3lG6L/6IyEYBEwY0jLJyrkGfeVbWq7HjRRoA35Pu09koCTrFvYZ wUY/btzuIntiX4m9uydO9hRfv096pMi7rdrs04xe6d4FmirB5BwMOl1Ag67T4NQBj8qK5KMORoJnC 2ORo2u11XGk2S+cyJNhq97RLPksiIygcSEXJO7qvWZvOkKMSONe4MRZbSQ2pfZ+359lu4N+m9pugL Z1+A3LtzpHqzQmHqx402kF8PSSaivXrzmAzqVOdMcVwP4SsjcCBOFqSxuTRjrok9UO+sHKA2PZqln bPkHOwDw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp8B-00HJNZ-35; Wed, 20 Dec 2023 05:28:32 +0000 Date: Wed, 20 Dec 2023 05:28:31 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Jan Kara Subject: [PATCH 16/22] udf_fiiter_add_entry(): check for zero ->d_name.len is bogus... Message-ID: <20231220052831.GO1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro Acked-by: Jan Kara --- fs/udf/namei.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/udf/namei.c b/fs/udf/namei.c index a64102d63781..b1674e07d5a5 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -228,8 +228,6 @@ static int udf_fiiter_add_entry(struct inode *dir, struct dentry *dentry, char name[UDF_NAME_LEN_CS0]; if (dentry) { - if (!dentry->d_name.len) - return -EINVAL; namelen = udf_put_filename(dir->i_sb, dentry->d_name.name, dentry->d_name.len, name, UDF_NAME_LEN_CS0); From patchwork Wed Dec 20 05:29:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499528 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 67B3CD26F; Wed, 20 Dec 2023 05:29:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="ntsXw42X" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Rj9TGYuRdibOR7FYQDjRe7HB2Vri7EPQAdMUow3lNHE=; b=ntsXw42XDZ3kMNcRk5CfgaO4L+ NG38q/EwzDjOiGkCPoOK+j7zqJ3OYMaHjJGmD1Ja3PBhnjKZHoArOlcntsazcvh8kxza2lWCqEv49 Tk5zKKIXx/soa5utaFom6E6qgaIBe/LzgweBN5vVbkya/h9ZBXBtINPv8QAWiVgkPUtXF7/naKoKP CbFTiD5I8vRFJo1gFL/xWv4GAtHc9hqk1HsrDyO/5S7bMzUOD4+YifdBUeiz5DTyeUngSPZfKWcl5 x4PH890iWv10+hDzvQldcxo+8IXRlDyxYt2ad5fnwbw4Zjb4mgt//bOKsST255l4bZV3/zoBzHz7L RVMmehoQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp93-00HJS2-2T; Wed, 20 Dec 2023 05:29:25 +0000 Date: Wed, 20 Dec 2023 05:29:25 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: ceph-devel@vger.kernel.org Subject: [PATCH 17/22] get rid of passing callbacks to ceph __dentry_leases_walk() Message-ID: <20231220052925.GP1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro __dentry_leases_walk() is gets a callback and calls it for a bunch of denties; there are exactly two callers and we already have a flag telling them apart - lwc->dir_lease. Seeing that indirect calls are costly these days, let's get rid of the callback and just call the right function directly. Has a side benefit of saner signatures... Signed-off-by Al Viro Reviewed-by: Xiubo Li --- fs/ceph/dir.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 91709934c8b1..768158743750 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1593,10 +1593,12 @@ struct ceph_lease_walk_control { unsigned long dir_lease_ttl; }; +static int __dir_lease_check(const struct dentry *, struct ceph_lease_walk_control *); +static int __dentry_lease_check(const struct dentry *); + static unsigned long __dentry_leases_walk(struct ceph_mds_client *mdsc, - struct ceph_lease_walk_control *lwc, - int (*check)(struct dentry*, void*)) + struct ceph_lease_walk_control *lwc) { struct ceph_dentry_info *di, *tmp; struct dentry *dentry, *last = NULL; @@ -1624,7 +1626,10 @@ __dentry_leases_walk(struct ceph_mds_client *mdsc, goto next; } - ret = check(dentry, lwc); + if (lwc->dir_lease) + ret = __dir_lease_check(dentry, lwc); + else + ret = __dentry_lease_check(dentry); if (ret & TOUCH) { /* move it into tail of dir lease list */ __dentry_dir_lease_touch(mdsc, di); @@ -1681,7 +1686,7 @@ __dentry_leases_walk(struct ceph_mds_client *mdsc, return freed; } -static int __dentry_lease_check(struct dentry *dentry, void *arg) +static int __dentry_lease_check(const struct dentry *dentry) { struct ceph_dentry_info *di = ceph_dentry(dentry); int ret; @@ -1696,9 +1701,9 @@ static int __dentry_lease_check(struct dentry *dentry, void *arg) return DELETE; } -static int __dir_lease_check(struct dentry *dentry, void *arg) +static int __dir_lease_check(const struct dentry *dentry, + struct ceph_lease_walk_control *lwc) { - struct ceph_lease_walk_control *lwc = arg; struct ceph_dentry_info *di = ceph_dentry(dentry); int ret = __dir_lease_try_check(dentry); @@ -1737,7 +1742,7 @@ int ceph_trim_dentries(struct ceph_mds_client *mdsc) lwc.dir_lease = false; lwc.nr_to_scan = CEPH_CAPS_PER_RELEASE * 2; - freed = __dentry_leases_walk(mdsc, &lwc, __dentry_lease_check); + freed = __dentry_leases_walk(mdsc, &lwc); if (!lwc.nr_to_scan) /* more invalid leases */ return -EAGAIN; @@ -1747,7 +1752,7 @@ int ceph_trim_dentries(struct ceph_mds_client *mdsc) lwc.dir_lease = true; lwc.expire_dir_lease = freed < count; lwc.dir_lease_ttl = mdsc->fsc->mount_options->caps_wanted_delay_max * HZ; - freed +=__dentry_leases_walk(mdsc, &lwc, __dir_lease_check); + freed +=__dentry_leases_walk(mdsc, &lwc); if (!lwc.nr_to_scan) /* more to check */ return -EAGAIN; From patchwork Wed Dec 20 05:30:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499529 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 0F7BC156DD; Wed, 20 Dec 2023 05:30:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="MduyeqHD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=8+pSMi90iMJbp8SNVldNRXoVmhwt4bobR2N1xwtpgos=; b=MduyeqHDXdk4CAFlDgc+yfIntB nYG6P715r5ZP0SI04laBhd1qm8IjbJvwsMAnbkgEcl60cobnMDMkjWDXKfST2hgXBAAWijYZYQ0Zg VAvuf880456lb5qkXBSlKItfQIW+h7MhkzZdjSKcau2LqrxOt+PBZG4zQVG+ruFdKMmo5R/vpscwN RXm95elbaDgnLQHFaXl7OnX5wQGUFTpJ3mhsgJgaAysU1/MYjX10JWxHuSU0rn/4zh/OK5L1Wr3lg kr9nJ/RZDC8/biOPNQThFQL6c5A7VceVIaSC1YKSTLUvQhvyarxHY0GPWsKpJSoNTXyHdq1IJHBfg wQvXVlPA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFp9p-00HJWS-14; Wed, 20 Dec 2023 05:30:13 +0000 Date: Wed, 20 Dec 2023 05:30:13 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH 18/22] nfsd: kill stale comment about simple_fill_super() requirements Message-ID: <20231220053013.GQ1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro That went into the tree back in 2005; the comment used to be true for predecessor of simple_fill_super() that happened to live in nfsd; that one didn't take care to skip the array entries with NULL ->name, so it could not tolerate any gaps. That had been fixed in 2003 when nfsd_fill_super() had been abstracted into simple_fill_super(); if Neil's patch lived out of tree during that time, he probably replaced the name of function when rebasing it and didn't notice that restriction in question was no longer there. Signed-off-by: Al Viro Acked-by: Chuck Lever --- fs/nfsd/nfsctl.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 3e15b72f421d..26a25e40c451 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -48,10 +48,6 @@ enum { NFSD_MaxBlkSize, NFSD_MaxConnections, NFSD_Filecache, - /* - * The below MUST come last. Otherwise we leave a hole in nfsd_files[] - * with !CONFIG_NFSD_V4 and simple_fill_super() goes oops - */ #ifdef CONFIG_NFSD_V4 NFSD_Leasetime, NFSD_Gracetime, From patchwork Wed Dec 20 05:31:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499530 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 8BF2615AC7; Wed, 20 Dec 2023 05:31:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="RVKU61um" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZHgu0AQ/45c1KhOXk4b/ywGXu8x5KY6GeTbYpQi4v/E=; b=RVKU61um3Adbdte+S06pAz6h57 DWPdD4bODQ3cG/0V0l5INNZiU3oanM1z5gsIMc+bty+VDsZEG5jBC1UZwvPOCRQDphNyCFR6T8C/A 41SpBERtJoxAmpRYrdbQxdXt6+47OjT5sMvIUg7xc4E4dJklT0tLKRXrKtu3wjh8Y+ucH5P2pD+7W 31SG0CjHDSenwD6VT4JahkyvKu1NSj5oEoGzA003oc2kGoenCpdfHCAizxSmrkeO8vamZIUEVQUqO WBN7314J0Ma00qqgNJ1QLGIFcFUUrNT2Wc9nTmSTSVJu2usV88MdiMKDj4bQLQxyM4qzAyAJllbHB TrDgeJ7g==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFpAd-00HJaz-0F; Wed, 20 Dec 2023 05:31:03 +0000 Date: Wed, 20 Dec 2023 05:31:03 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: ocfs2-devel@lists.linux.dev Subject: [PATCH 19/22] ocfs2_find_match(): there's no such thing as NULL or negative ->d_parent Message-ID: <20231220053103.GR1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro Signed-off-by: Al Viro --- fs/ocfs2/dcache.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index 04fc8344063a..a9b8688aaf30 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c @@ -124,17 +124,10 @@ static int ocfs2_match_dentry(struct dentry *dentry, if (!dentry->d_fsdata) return 0; - if (!dentry->d_parent) - return 0; - if (skip_unhashed && d_unhashed(dentry)) return 0; parent = d_inode(dentry->d_parent); - /* Negative parent dentry? */ - if (!parent) - return 0; - /* Name is in a different directory. */ if (OCFS2_I(parent)->ip_blkno != parent_blkno) return 0; From patchwork Wed Dec 20 05:31:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499531 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 A40E9FBE0; Wed, 20 Dec 2023 05:31:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="IADMORZI" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XdcwRFuxJFKq99IE3tvSnvlBhdDly6BThkl5nosSsP4=; b=IADMORZI+3lPwbJ29d1FsZ6Hzy 8H62qO0PEl4st+u+VG4QfRfPe301F+2UnxunF7WdKlxdBxvBc5dp4aUs3Wk9SRko9QxbHSa1heIWU oAJlt31VOn6lgJrHutdTuDx6eJ5zy8qdCkr3fiCEIuzwB1GlatOj6bRoBvGdN5pvEwokTE/8Mf1t7 UyF5OFwBEEMxh4Gak6n505r8MxeidZVf9GRG8bZ4qpkpGJKDrJ17N4LSLJIfbnbBF6M2YXGIXsMu6 aQZSNBJr/xeUcBUNiqCCqKfd2xOXL72hyJ6QoE3HtPU0wTcpsnFtKYXFNEjoz3xZTh+x/8m4ibkF3 dyjKem5Q==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFpBV-00HJfX-0X; Wed, 20 Dec 2023 05:31:57 +0000 Date: Wed, 20 Dec 2023 05:31:57 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: gfs2@lists.linux.dev Subject: [PATCH 20/22] gfs2: use is_subdir() Message-ID: <20231220053157.GS1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro ... instead of reimplementing it with misguiding name (is_ancestor(x, y) would normally imply "x is an ancestor of y", not the other way round). With races, while we are at it... Signed-off-by: Al Viro --- fs/gfs2/super.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index d21c04a22d73..b5c75c8a8d62 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c @@ -1065,16 +1065,6 @@ static int gfs2_drop_inode(struct inode *inode) return generic_drop_inode(inode); } -static int is_ancestor(const struct dentry *d1, const struct dentry *d2) -{ - do { - if (d1 == d2) - return 1; - d1 = d1->d_parent; - } while (!IS_ROOT(d1)); - return 0; -} - /** * gfs2_show_options - Show mount options for /proc/mounts * @s: seq_file structure @@ -1096,7 +1086,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) statfs_slow = sdp->sd_tune.gt_statfs_slow; spin_unlock(&sdp->sd_tune.gt_spin); - if (is_ancestor(root, sdp->sd_master_dir)) + if (is_subdir(root, sdp->sd_master_dir)) seq_puts(s, ",meta"); if (args->ar_lockproto[0]) seq_show_option(s, "lockproto", args->ar_lockproto); From patchwork Wed Dec 20 05:32:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499543 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 A8420125AC for ; Wed, 20 Dec 2023 05:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="o/4agRSk" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=kccFgVGlbm9kT2ZOcrKRGrw8T0580qXJFRiqe+lUSzM=; b=o/4agRSkMZ45eg1tgx/RV30YP9 lxB0Vxb5VRtufyO1p7RaZLPPsnC2ivPQjEzhm4qFZmyEqWpDoAdzaaKRd0Qu4AeyFAT7df40CEHgp BpUPhPG3O+PqR6i06aZclzLJ11jLN5zeKoqUATx2U5F4KJwyzzcnifbndciYhi2JNO28PtTnGWSO/ JWFkEdk2qS+AWze3L6fkIpwXLoswGdAIBqATdk4OMPpCNsC9yKtBEj5b18x+bEwnqmn59bA2OG6o/ YjMJXVhGQDiAqXZkygFiWQ0ZdKtHsg6+QDFXcrhA3eyJX15DKkFHT93DUxtHYZJ3cLXXu24t4GYIU uPGl8pIw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFpCA-00HJje-2p; Wed, 20 Dec 2023 05:32:39 +0000 Date: Wed, 20 Dec 2023 05:32:38 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: devel@lists.orangefs.org Subject: [PATCH 21/22] orangefs: saner arguments passing in readdir guts Message-ID: <20231220053238.GT1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro orangefs_dir_fill() doesn't use oi and dentry arguments at all do_readdir() gets dentry, uses only dentry->d_inode; it also gets oi, which is ORANGEFS_I(dentry->d_inode) (i.e. ->d_inode - constant offset). orangefs_dir_mode() gets dentry and oi, uses only to pass those to do_readdir(). orangefs_dir_iterate() uses dentry and oi only to pass those to orangefs_dir_fill() and orangefs_dir_more(). The only thing it really needs is ->d_inode; moreover, that's better expressed as file_inode(file) - no need to go through ->f_path.dentry->d_inode. Signed-off-by: Al Viro --- fs/orangefs/dir.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/fs/orangefs/dir.c b/fs/orangefs/dir.c index 9cacce5d55c1..6d1fbeca9d81 100644 --- a/fs/orangefs/dir.c +++ b/fs/orangefs/dir.c @@ -58,10 +58,10 @@ struct orangefs_dir { * first part of the part list. */ -static int do_readdir(struct orangefs_inode_s *oi, - struct orangefs_dir *od, struct dentry *dentry, +static int do_readdir(struct orangefs_dir *od, struct inode *inode, struct orangefs_kernel_op_s *op) { + struct orangefs_inode_s *oi = ORANGEFS_I(inode); struct orangefs_readdir_response_s *resp; int bufi, r; @@ -87,7 +87,7 @@ static int do_readdir(struct orangefs_inode_s *oi, op->upcall.req.readdir.buf_index = bufi; r = service_operation(op, "orangefs_readdir", - get_interruptible_flag(dentry->d_inode)); + get_interruptible_flag(inode)); orangefs_readdir_index_put(bufi); @@ -158,8 +158,7 @@ static int parse_readdir(struct orangefs_dir *od, return 0; } -static int orangefs_dir_more(struct orangefs_inode_s *oi, - struct orangefs_dir *od, struct dentry *dentry) +static int orangefs_dir_more(struct orangefs_dir *od, struct inode *inode) { struct orangefs_kernel_op_s *op; int r; @@ -169,7 +168,7 @@ static int orangefs_dir_more(struct orangefs_inode_s *oi, od->error = -ENOMEM; return -ENOMEM; } - r = do_readdir(oi, od, dentry, op); + r = do_readdir(od, inode, op); if (r) { od->error = r; goto out; @@ -238,9 +237,7 @@ static int fill_from_part(struct orangefs_dir_part *part, return 1; } -static int orangefs_dir_fill(struct orangefs_inode_s *oi, - struct orangefs_dir *od, struct dentry *dentry, - struct dir_context *ctx) +static int orangefs_dir_fill(struct orangefs_dir *od, struct dir_context *ctx) { struct orangefs_dir_part *part; size_t count; @@ -304,15 +301,10 @@ static loff_t orangefs_dir_llseek(struct file *file, loff_t offset, static int orangefs_dir_iterate(struct file *file, struct dir_context *ctx) { - struct orangefs_inode_s *oi; - struct orangefs_dir *od; - struct dentry *dentry; + struct orangefs_dir *od = file->private_data; + struct inode *inode = file_inode(file); int r; - dentry = file->f_path.dentry; - oi = ORANGEFS_I(dentry->d_inode); - od = file->private_data; - if (od->error) return od->error; @@ -342,7 +334,7 @@ static int orangefs_dir_iterate(struct file *file, */ while (od->token != ORANGEFS_ITERATE_END && ctx->pos > od->end) { - r = orangefs_dir_more(oi, od, dentry); + r = orangefs_dir_more(od, inode); if (r) return r; } @@ -351,17 +343,17 @@ static int orangefs_dir_iterate(struct file *file, /* Then try to fill if there's any left in the buffer. */ if (ctx->pos < od->end) { - r = orangefs_dir_fill(oi, od, dentry, ctx); + r = orangefs_dir_fill(od, ctx); if (r) return r; } /* Finally get some more and try to fill. */ if (od->token != ORANGEFS_ITERATE_END) { - r = orangefs_dir_more(oi, od, dentry); + r = orangefs_dir_more(od, inode); if (r) return r; - r = orangefs_dir_fill(oi, od, dentry, ctx); + r = orangefs_dir_fill(od, ctx); } return r; From patchwork Wed Dec 20 05:33:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13499544 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 9FE13156DD for ; Wed, 20 Dec 2023 05:33:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="HzDd+azD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=JEsBIIZq7ARW+vWFkRPXkXpSNO+fGKJrrx/Q6gEIHO4=; b=HzDd+azD232qj33DLxPKk7wUad koHHW5jLk9VH6jmmeVhq8Joe+Xdfi7EqpXgNQQEBeAHju/bY0PRFfYte14olLS9PNr99J42tYXN8Y ztdb09EJRW9y7RgVHZeP8zWwykSKxAB13uO3B4V072J0TA3nSVE/In0Ll36lU+BkrFL6VYF6gV91O sts92oCIgHLs+ur2NWMjRUVxkF/ApaPv0WJhVNEyvuOklnUmVpmMUCmGHHv9uoqM/TmR8b2hVFbDN 9mDUKrWz8hThVa1IyDuYOH6Hmi+f6Wn42FJKHuLe+wpww4DP83Y1175uxgpNkgVILD6Z/ToXOzZOn FLQMX/aQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rFpD1-00HJnY-30; Wed, 20 Dec 2023 05:33:32 +0000 Date: Wed, 20 Dec 2023 05:33:31 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: apparmor@lists.ubuntu.com Subject: [PATCH 22/22] apparmorfs: don't duplicate kfree_link() Message-ID: <20231220053331.GU1674809@ZenIV> References: <20231220051348.GY1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231220051348.GY1674809@ZenIV> Sender: Al Viro rawdata_link_cb() is identical to it Signed-off-by: Al Viro --- security/apparmor/apparmorfs.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 38650e52ef57..63ca77103de9 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -1615,11 +1615,6 @@ static char *gen_symlink_name(int depth, const char *dirname, const char *fname) return buffer; } -static void rawdata_link_cb(void *arg) -{ - kfree(arg); -} - static const char *rawdata_get_link_base(struct dentry *dentry, struct inode *inode, struct delayed_call *done, @@ -1643,7 +1638,7 @@ static const char *rawdata_get_link_base(struct dentry *dentry, if (IS_ERR(target)) return target; - set_delayed_call(done, rawdata_link_cb, target); + set_delayed_call(done, kfree_link, target); return target; }