]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] sd: fix array cache flushing bug causing performance problems
authorJames Bottomley <JBottomley@Parallels.com>
Wed, 24 Apr 2013 21:02:53 +0000 (14:02 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 2 May 2013 23:15:54 +0000 (16:15 -0700)
commitc6cd57e6a3136bc88b70c3a1482ca2eef553d552
tree7d8b3f42a70e8f0caea47bebc1b113f79753baca
parent5388034ec33fe424fe551caffa61195a6f659d4a
[SCSI] sd: fix array cache flushing bug causing performance problems

Some arrays synchronize their full non volatile cache when the sd driver sends
a SYNCHRONIZE CACHE command.  Unfortunately, they can have Terrabytes of this
and we send a SYNCHRONIZE CACHE for every barrier if an array reports it has a
writeback cache.  This leads to massive slowdowns on journalled filesystems.

The fix is to allow userspace to turn off the writeback cache setting as a
temporary measure (i.e. without doing the MODE SELECT to write it back to the
device), so even though the device reported it has a writeback cache, the
user, knowing that the cache is non volatile and all they care about is
filesystem correctness, can turn that bit off in the kernel and avoid the
performance ruinous (and safety irrelevant) SYNCHRONIZE CACHE commands.

The way you do this is add a 'temporary' prefix when performing the usual
cache setting operations, so

echo temporary write through > /sys/class/scsi_disk/<disk>/cache_type

Reported-by: Ric Wheeler <rwheeler@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/sd.c
drivers/scsi/sd.h