mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiubo Li <xiubli@redhat.com>
To: "Luís Henriques" <lhenriques@suse.de>,
	"Ilya Dryomov" <idryomov@gmail.com>,
	"Jeff Layton" <jlayton@kernel.org>,
	"Milind Changire" <mchangir@redhat.com>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] ceph: remove unnecessary check for NULL in parse_longname()
Date: Fri, 8 Sep 2023 08:14:19 +0800	[thread overview]
Message-ID: <3493bd1b-4982-e851-a2bc-c806889af01e@redhat.com> (raw)
In-Reply-To: <20230907133928.11126-1-lhenriques@suse.de>


On 9/7/23 21:39, Luís Henriques wrote:
> Function ceph_get_inode() never returns NULL; instead it returns an
> ERR_PTR() if something fails.  Thus, the check for NULL in
> parse_longname() useless and can be dropped.
>
> Fixes: dd66df0053ef ("ceph: add support for encrypted snapshot names")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Luís Henriques <lhenriques@suse.de>
> ---
>   fs/ceph/crypto.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c
> index e4d5cd56a80b..7d0b9b5ccfc6 100644
> --- a/fs/ceph/crypto.c
> +++ b/fs/ceph/crypto.c
> @@ -249,8 +249,6 @@ static struct inode *parse_longname(const struct inode *parent,
>   	if (!dir) {
>   		/* This can happen if we're not mounting cephfs on the root */
>   		dir = ceph_get_inode(parent->i_sb, vino, NULL);
> -		if (!dir)
> -			dir = ERR_PTR(-ENOENT);
>   	}
>   	if (IS_ERR(dir))
>   		dout("Can't find inode %s (%s)\n", inode_number, name);
>
Luis,

How about moving the error check into the  'if (!dir) {}' ? Because from 
'ceph_find_inode()' the return value shouldn't be true here. This err 
check should for 'ceph_get_inode()' only.

Thanks

- Xiubo



  reply	other threads:[~2023-09-08  0:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07 13:39 Luís Henriques
2023-09-08  0:14 ` Xiubo Li [this message]
2023-09-08  8:39   ` Luís Henriques

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3493bd1b-4982-e851-a2bc-c806889af01e@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=lhenriques@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchangir@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®