* [PATCH] ceph: remove unnecessary check for NULL in parse_longname()
@ 2023-09-07 13:39 Luís Henriques
2023-09-08 0:14 ` Xiubo Li
0 siblings, 1 reply; 3+ messages in thread
From: Luís Henriques @ 2023-09-07 13:39 UTC (permalink / raw)
To: Xiubo Li, Ilya Dryomov, Jeff Layton, Milind Changire
Cc: ceph-devel, linux-kernel, Luís Henriques, Dan Carpenter
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);
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ceph: remove unnecessary check for NULL in parse_longname()
2023-09-07 13:39 [PATCH] ceph: remove unnecessary check for NULL in parse_longname() Luís Henriques
@ 2023-09-08 0:14 ` Xiubo Li
2023-09-08 8:39 ` Luís Henriques
0 siblings, 1 reply; 3+ messages in thread
From: Xiubo Li @ 2023-09-08 0:14 UTC (permalink / raw)
To: Luís Henriques, Ilya Dryomov, Jeff Layton, Milind Changire
Cc: ceph-devel, linux-kernel, Dan Carpenter
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ceph: remove unnecessary check for NULL in parse_longname()
2023-09-08 0:14 ` Xiubo Li
@ 2023-09-08 8:39 ` Luís Henriques
0 siblings, 0 replies; 3+ messages in thread
From: Luís Henriques @ 2023-09-08 8:39 UTC (permalink / raw)
To: Xiubo Li
Cc: Ilya Dryomov, Jeff Layton, Milind Changire, ceph-devel,
linux-kernel, Dan Carpenter
Xiubo Li <xiubli@redhat.com> writes:
> 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.
Yeah, you're right. Thanks, Xiubo. I'll send out v2 shortly.
Cheers,
--
Luís
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-08 8:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-07 13:39 [PATCH] ceph: remove unnecessary check for NULL in parse_longname() Luís Henriques
2023-09-08 0:14 ` Xiubo Li
2023-09-08 8:39 ` Luís Henriques
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox