]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
scsi: fix the {host,target,device}_blocked counter mess
authorChristoph Hellwig <hch@lst.de>
Thu, 23 Jan 2014 11:07:41 +0000 (12:07 +0100)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 Jul 2014 21:15:48 +0000 (17:15 -0400)
commitcd9070c9c512ff7995f9019392e0ae548df3a088
treea426fccd5633f429f37dac237d8cf417ad9e7f31
parent71e75c97f97a9645d25fbf3d8e4165a558f18747
scsi: fix the {host,target,device}_blocked counter mess

Seems like these counters are missing any sort of synchronization for
updates, as a over 10 year old comment from me noted.  Fix this by
using atomic counters, and while we're at it also make sure they are
in the same cacheline as the _busy counters and not needlessly stored
to in every I/O completion.

With the new model the _busy counters can temporarily go negative,
so all the readers are updated to check for > 0 values.  Longer
term every successful I/O completion will reset the counters to zero,
so the temporarily negative values will not cause any harm.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Webb Scales <webbnh@hp.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Tested-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Robert Elliott <elliott@hp.com>
drivers/scsi/scsi.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_sysfs.c
include/scsi/scsi_device.h
include/scsi/scsi_host.h