scsi: hisi_sas: use atomic64_t for hisi_sas_device.running_req

Sometimes the value of hisi_sas_device.running_req
would go negative unless we have the check for
running_req >= 0 before trying to decrement.

This is because using running_req is not thread-safe.

As such, the value for running_req may be actually incorrect,
so use atomic64_t instead.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Xiang Chen <chenxiang66@hisilicon.com>
Reviewed-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
John Garry
2016-11-07 20:48:39 +08:00
committed by Martin K. Petersen
parent 04708ff4c2
commit f696cc32b5
4 changed files with 10 additions and 9 deletions

View File

@@ -111,7 +111,7 @@ struct hisi_sas_device {
struct domain_device *sas_device;
u64 attached_phy;
u64 device_id;
u64 running_req;
atomic64_t running_req;
u8 dev_status;
};