mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-18 02:46:06 +00:00
nvmet: handle keep-alive timer when kato is modified by a set features cmd
A user may modify the kato by a set features cmd. To properly deal with races or a kato value of 0 (no keep alive enabled) change nvmet_set_feat_kato to first disable the timer, then set the value and then re-enable the timer. Signed-off-by: Amit Engel <amit.engel@dell.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
f7790e5de9
commit
4e683c48db
@ -727,7 +727,9 @@ u16 nvmet_set_feat_kato(struct nvmet_req *req)
|
||||
{
|
||||
u32 val32 = le32_to_cpu(req->cmd->common.cdw11);
|
||||
|
||||
nvmet_stop_keep_alive_timer(req->sq->ctrl);
|
||||
req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000);
|
||||
nvmet_start_keep_alive_timer(req->sq->ctrl);
|
||||
|
||||
nvmet_set_result(req, req->sq->ctrl->kato);
|
||||
|
||||
|
@ -395,7 +395,7 @@ static void nvmet_keep_alive_timer(struct work_struct *work)
|
||||
nvmet_ctrl_fatal_error(ctrl);
|
||||
}
|
||||
|
||||
static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
|
||||
void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
|
||||
{
|
||||
if (unlikely(ctrl->kato == 0))
|
||||
return;
|
||||
@ -407,7 +407,7 @@ static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
|
||||
schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
|
||||
}
|
||||
|
||||
static void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl)
|
||||
void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl)
|
||||
{
|
||||
if (unlikely(ctrl->kato == 0))
|
||||
return;
|
||||
|
@ -395,6 +395,8 @@ void nvmet_get_feat_async_event(struct nvmet_req *req);
|
||||
u16 nvmet_set_feat_kato(struct nvmet_req *req);
|
||||
u16 nvmet_set_feat_async_event(struct nvmet_req *req, u32 mask);
|
||||
void nvmet_execute_async_event(struct nvmet_req *req);
|
||||
void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl);
|
||||
void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl);
|
||||
|
||||
u16 nvmet_parse_connect_cmd(struct nvmet_req *req);
|
||||
void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user