Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hou Pu <houpu.main@gmail.com>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Cc: "sagi@grimberg.me" <sagi@grimberg.me>, "hch@lst.de" <hch@lst.de>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH] nvmet: avoid queuing keep-alive timer if it is disabled
Date: Fri, 16 Apr 2021 10:48:45 +0800	[thread overview]
Message-ID: <5ef49cb5-7784-5ec5-b225-e181556fa908@gmail.com> (raw)
In-Reply-To: <BYAPR04MB49659A9C02A2344BB68BB7B6864D9@BYAPR04MB4965.namprd04.prod.outlook.com>


On 2021/4/16 4:17 AM, Chaitanya Kulkarni wrote:
> Hou,
>
> On 4/15/21 02:07, Hou Pu wrote:
>> ---
>>   drivers/nvme/target/admin-cmd.c | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
>> index f4cc32674edd..b8a33d1506ba 100644
>> --- a/drivers/nvme/target/admin-cmd.c
>> +++ b/drivers/nvme/target/admin-cmd.c
>> @@ -926,8 +926,12 @@ void nvmet_execute_keep_alive(struct nvmet_req *req)
>>   	pr_debug("ctrl %d update keep-alive timer for %d secs\n",
>>   		ctrl->cntlid, ctrl->kato);
>>   
>> -	mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
>> -	nvmet_req_complete(req, 0);
>> +	if (ctrl->kato) {
>> +		mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
>> +		nvmet_req_complete(req, 0);
>> +		return;
>> +	}
>> +	nvmet_req_complete(req, NVME_SC_KA_TIMEOUT_INVALID);
>>   }
>>   
>>   u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
>> -- 2.28.0
> I've validated that this behaviour does exists and this patch
> fixes that.Please add my :-
>
> Tested-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>

Thanks.

>
> Also, please consider following on the top of this patch :-

Thanks. Changed in v2.

>
> diff --git a/drivers/nvme/target/admin-cmd.c
> b/drivers/nvme/target/admin-cmd.c
> index a892cd246783..3422d35b25a1 100644
> --- a/drivers/nvme/target/admin-cmd.c
> +++ b/drivers/nvme/target/admin-cmd.c
> @@ -1010,19 +1010,21 @@ void nvmet_execute_async_event(struct nvmet_req
> *req)
>   void nvmet_execute_keep_alive(struct nvmet_req *req)
>   {
>          struct nvmet_ctrl *ctrl = req->sq->ctrl;
> +       u16 status = 0;
>   
>          if (!nvmet_check_transfer_len(req, 0))
>                  return;
>   
> +       if (!ctrl->kato) {
> +               status = NVME_SC_KA_TIMEOUT_INVALID;
> +               goto out;
> +       }
> +
>          pr_debug("ctrl %d update keep-alive timer for %d secs\n",
>                  ctrl->cntlid, ctrl->kato);
> -
> -       if (ctrl->kato) {
> -               mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato *
> HZ);
> -               nvmet_req_complete(req, 0);
> -               return;
> -       }
> -       nvmet_req_complete(req, NVME_SC_KA_TIMEOUT_INVALID);
> +       mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
> +out:
> +       nvmet_req_complete(req, status);
>   }
>   
>   u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
>   
>
Thanks,

Hou



_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

      reply	other threads:[~2021-04-16  2:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15  9:05 [PATCH] nvmet: avoid queuing keep-alive timer if it is disabled Hou Pu
2021-04-15 20:17 ` Chaitanya Kulkarni
2021-04-16  2:48   ` Hou Pu [this message]

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=5ef49cb5-7784-5ec5-b225-e181556fa908@gmail.com \
    --to=houpu.main@gmail.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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