From 752581585232edfcba2fae1cf6b8f0b44692cded Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 29 Mar 2012 02:21:37 +0000 Subject: [PATCH] Note from Alexander Lyakas about errors caching by FILEIO handler git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4176 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/README | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/scst/README b/scst/README index 655fa69e7..e7bb28c2b 100644 --- a/scst/README +++ b/scst/README @@ -1471,6 +1471,45 @@ Note, on some real-life workloads write through caching might perform better, than write back one with the barrier protection turned on. +Errors caching +.............. + +When using virtual device in FILEIO mode, the Linux page cache comes +into picture. The negative side of it is that it's sometimes also +caching errored pages. That is, if the underlying file experiences IO +errors, those errors might be cached by the Linux page cache. As a +result, even when the underlying file recovers and stops failing IOs, +the initiator may still hit IO errors returned by the Linux page cache, +until the cache re-reads the errored pages (usually it happens pretty +soon, but not immediately). To make sure that cached pages are dropped, +one of the following can be done: + +- Detach the SCSI virtual device (del_device) and re-attach it + (add_device). This should evict all the cached pages, unless somebody + else holds the same "filename" opened. + +- Issue a BLKFLSBUF ioctl to the same "filename" you provided for "add_device". + +For the second option, a rudimentary C code is required: + +fd = open(filename, O_RDWR); +if (fd < 0) { + err = errno; + ... +} +else { + err = ioctl(fd, BLKFLSBUF); + if (err < 0) { + err = errno; + ... + } + close(fd); +} + +Patch to implement a sysfs entry for the FILEIO handler to accomplish +the above is welcome. + + BLOCKIO VDISK mode ------------------