[RFC] libceph: remove the useless monc check
diff mbox series

Message ID 20191015025242.5729-1-xiubli@redhat.com
State New
Headers show
Series
  • [RFC] libceph: remove the useless monc check
Related show

Commit Message

Xiubo Li Oct. 15, 2019, 2:52 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

There is no reason that the con->private will be NULL for mon client,
once it is here in dispatch() routine the con->monc->private should
already correctly set done. And also just before the dispatch() in
try_read() it will also reference the con->monc->private to allocate
memory for in_msg.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 net/ceph/mon_client.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Ilya Dryomov Oct. 15, 2019, 8:30 a.m. UTC | #1
On Tue, Oct 15, 2019 at 4:52 AM <xiubli@redhat.com> wrote:
>
> From: Xiubo Li <xiubli@redhat.com>
>
> There is no reason that the con->private will be NULL for mon client,
> once it is here in dispatch() routine the con->monc->private should
> already correctly set done. And also just before the dispatch() in
> try_read() it will also reference the con->monc->private to allocate
> memory for in_msg.
>
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  net/ceph/mon_client.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
> index 7256c402ebaa..9d9e4e4ea600 100644
> --- a/net/ceph/mon_client.c
> +++ b/net/ceph/mon_client.c
> @@ -1233,9 +1233,6 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
>         struct ceph_mon_client *monc = con->private;
>         int type = le16_to_cpu(msg->hdr.type);
>
> -       if (!monc)
> -               return;
> -
>         switch (type) {
>         case CEPH_MSG_AUTH_REPLY:
>                 handle_auth_reply(monc, msg);

Hi Xiubo,

I applied the same patch yesterday:

https://github.com/ceph/ceph-client/commit/dd6b2054abec7e9a50c330619b870a018a5fd718

Thanks,

                Ilya
Xiubo Li Oct. 15, 2019, 8:41 a.m. UTC | #2
On 2019/10/15 16:30, Ilya Dryomov wrote:
> On Tue, Oct 15, 2019 at 4:52 AM <xiubli@redhat.com> wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> There is no reason that the con->private will be NULL for mon client,
>> once it is here in dispatch() routine the con->monc->private should
>> already correctly set done. And also just before the dispatch() in
>> try_read() it will also reference the con->monc->private to allocate
>> memory for in_msg.
>>
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>>   net/ceph/mon_client.c | 3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
>> index 7256c402ebaa..9d9e4e4ea600 100644
>> --- a/net/ceph/mon_client.c
>> +++ b/net/ceph/mon_client.c
>> @@ -1233,9 +1233,6 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
>>          struct ceph_mon_client *monc = con->private;
>>          int type = le16_to_cpu(msg->hdr.type);
>>
>> -       if (!monc)
>> -               return;
>> -
>>          switch (type) {
>>          case CEPH_MSG_AUTH_REPLY:
>>                  handle_auth_reply(monc, msg);
> Hi Xiubo,
>
> I applied the same patch yesterday:

Ah, Cool.

I missed that mail.

Xiubo


> https://github.com/ceph/ceph-client/commit/dd6b2054abec7e9a50c330619b870a018a5fd718
>
> Thanks,
>
>                  Ilya

Patch
diff mbox series

diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 7256c402ebaa..9d9e4e4ea600 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -1233,9 +1233,6 @@  static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
 	struct ceph_mon_client *monc = con->private;
 	int type = le16_to_cpu(msg->hdr.type);
 
-	if (!monc)
-		return;
-
 	switch (type) {
 	case CEPH_MSG_AUTH_REPLY:
 		handle_auth_reply(monc, msg);