On 05/05/2015 08:21 AM, Christoph Hellwig wrote:
On Fri, May 01, 2015 at 12:24:13PM -0700, Andy Grover wrote:
Hey, at least it's just a bug and not another API issue.
I think it is, see below.
So, TCMU just wants its tcmu_execute_rw called just once, even for BIDI
commands (e.g. COMPARE_AND_WRITE and XDWRITEREAD*)
COMPARE_AND_WRITE isn't a bidi command, it's a command that in pratice
uses two DATA OUT buffers but partitioning the one available to it.
OK. I think I need to read specs more closely. :)
Can you explain why you want this? Right now backends in lio have a very
simple abstraction for I/O, why do read and writes and most other
things are built ontop of that, with a few exception for "magic" commands
like the various discard operations.
The goal is to pass through just SBC I/O commands to userspace, with the
rest of the commands emulated by LIO core.
COMPARE_AND_WRITE is build on top of those basic operations by doing
the reads and writes underneath, and providing synchronization in the
core. If a backend (that is a non-passthrough) one wants to take control
of these we need a specific hook for it instead of trying ot hack it up.
The issue is that sbc_parse_cdb does most of what TCMU wants (set up non
I/O cmds for emulation, send us the rest) but the unwanted bit is
emulating BIDI & CAW ops as read-then-write, and sync via caw_sem. We
want pure pass through for SBC I/O ops, including BIDIs and CAW.
See http://article.gmane.org/gmane.linux.scsi.target.devel/8689
Solutions? In tcmu_parse_cdb we can avoid calling sbc_parse_cdb when it
will do the wrong thing (option 1) or always call sbc_parse_cdb but fix
up when it did the wrong thing (option 2) or always call sbc_parse_cdb
but fix up later (option 3) or make CAW in TCMU work with the emulation
sbc_parse_cdb is setting up (option 4) or return an error if CAW is used
with a TCMU-backed device (option 5 (new)) or add an arg to
sbc_parse_cdb so it can avoid setting up the emulation we don't want
(option 6 (new)) or don't call sbc_parse_cdb at all and set up non-I/O
cmd emulation in tcmu_parse_cdb (option 7 (new)).
Ilias and I thought #2 was least ugly, but what's your preference?
I'm not entirely happy with adding this without a new in-kernel user given
that we need to get the semantics right.
...just trying to come up with a solution for the issue that you discovered.
Regards -- Andy
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html