diff mbox series

nilfs2: d_obtain_alias(ERR_PTR(...)) will do the right thing...

Message ID 20231220052310.GI1674809@ZenIV (mailing list archive)
State New
Headers show
Series nilfs2: d_obtain_alias(ERR_PTR(...)) will do the right thing... | expand

Commit Message

Al Viro Dec. 20, 2023, 5:23 a.m. UTC
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/nilfs2/namei.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Ryusuke Konishi Dec. 20, 2023, 2:46 p.m. UTC | #1
On Wed, Dec 20, 2023 at 2:23 PM Al Viro wrote:
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
>  fs/nilfs2/namei.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
> index 2a4e7f4a8102..8e8c7c981a7a 100644
> --- a/fs/nilfs2/namei.c
> +++ b/fs/nilfs2/namei.c
> @@ -439,7 +439,6 @@ static int nilfs_rename(struct mnt_idmap *idmap,
>  static struct dentry *nilfs_get_parent(struct dentry *child)
>  {
>         unsigned long ino;
> -       struct inode *inode;
>         struct nilfs_root *root;
>
>         ino = nilfs_inode_by_name(d_inode(child), &dotdot_name);
> @@ -448,11 +447,7 @@ static struct dentry *nilfs_get_parent(struct dentry *child)
>
>         root = NILFS_I(d_inode(child))->i_root;
>
> -       inode = nilfs_iget(child->d_sb, root, ino);
> -       if (IS_ERR(inode))
> -               return ERR_CAST(inode);
> -
> -       return d_obtain_alias(inode);
> +       return d_obtain_alias(nilfs_iget(child->d_sb, root, ino));
>  }
>
>  static struct dentry *nilfs_get_dentry(struct super_block *sb, u64 cno,
> --
> 2.39.2
>

Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>

Thanks,
Ryusuke Konishi
diff mbox series

Patch

diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index 2a4e7f4a8102..8e8c7c981a7a 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -439,7 +439,6 @@  static int nilfs_rename(struct mnt_idmap *idmap,
 static struct dentry *nilfs_get_parent(struct dentry *child)
 {
 	unsigned long ino;
-	struct inode *inode;
 	struct nilfs_root *root;
 
 	ino = nilfs_inode_by_name(d_inode(child), &dotdot_name);
@@ -448,11 +447,7 @@  static struct dentry *nilfs_get_parent(struct dentry *child)
 
 	root = NILFS_I(d_inode(child))->i_root;
 
-	inode = nilfs_iget(child->d_sb, root, ino);
-	if (IS_ERR(inode))
-		return ERR_CAST(inode);
-
-	return d_obtain_alias(inode);
+	return d_obtain_alias(nilfs_iget(child->d_sb, root, ino));
 }
 
 static struct dentry *nilfs_get_dentry(struct super_block *sb, u64 cno,