Issues when using AIO - WRITE_SAME not supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, I have been having issues using tgtd with the AIO backing store.

When booting an Ubuntu 18.04 server image over iscsi the client
attempts to use the WRITE_SAME(16) operation, which tgtd's AIO backing
store does not support. This results in the following errors on the
client:

kernel: [ 66.542374] sd 11:0:0:1: [sda] tag#0 FAILED Result:
hostbyte=DID_OK driverbyte=DRIVER_SENSE
kernel: [ 66.542378] sd 11:0:0:1: [sda] tag#0 Sense Key : Hardware
Error [current]
kernel: [ 66.542382] sd 11:0:0:1: [sda] tag#0 Add. Sense: Internal
target failure
kernel: [ 66.542385] sd 11:0:0:1: [sda] tag#0 CDB: Write same(16) 93
00 00 00 00 00 00 42 90 68 00 00 3f a0 00 00
kernel: [ 66.542388] print_req_error: critical target error, dev sda,
sector 4362344

And on the server running tgtd:

tgtd[10965]: tgtd: bs_aio_cmd_submit(218) WRITE_SAME not yet supported
for AIO backend.

I see that other backing stores call bs_create_opcode_map() before
registering their template but not AIO. When applying the following
patch I no longer see these errors.

diff --git a/usr/bs_aio.c b/usr/bs_aio.c
index 4d84db4..00a232a 100644
--- a/usr/bs_aio.c
+++ b/usr/bs_aio.c
@@ -424,6 +424,49 @@ static struct backingstore_template aio_bst = {

 __attribute__((constructor)) static void register_bs_module(void)
 {
+       unsigned char opcodes[] = {
+               ALLOW_MEDIUM_REMOVAL,
+               COMPARE_AND_WRITE,
+               FORMAT_UNIT,
+               INQUIRY,
+               MAINT_PROTOCOL_IN,
+               MODE_SELECT,
+               MODE_SELECT_10,
+               MODE_SENSE,
+               MODE_SENSE_10,
+               ORWRITE_16,
+               PERSISTENT_RESERVE_IN,
+               PERSISTENT_RESERVE_OUT,
+               PRE_FETCH_10,
+               PRE_FETCH_16,
+               READ_10,
+               READ_12,
+               READ_16,
+               READ_6,
+               READ_CAPACITY,
+               RELEASE,
+               REPORT_LUNS,
+               REQUEST_SENSE,
+               RESERVE,
+               SEND_DIAGNOSTIC,
+               SERVICE_ACTION_IN,
+               START_STOP,
+               SYNCHRONIZE_CACHE,
+               SYNCHRONIZE_CACHE_16,
+               TEST_UNIT_READY,
+               UNMAP,
+               VERIFY_10,
+               VERIFY_12,
+               VERIFY_16,
+               WRITE_10,
+               WRITE_12,
+               WRITE_16,
+               WRITE_6,
+               WRITE_VERIFY,
+               WRITE_VERIFY_12,
+               WRITE_VERIFY_16
+       };
+       bs_create_opcode_map(&aio_bst, opcodes, ARRAY_SIZE(opcodes));
        register_backingstore_template(&aio_bst);
 }

My understanding is that this results in the server informing the
client that the SCSI WRITE_SAME* opcodes are not supported, and the
client then resorts to using multiple WRITE_* opcodes instead. What
happens currently is the server fails to execute the operation in an
ungraceful manner, hence the errors.

I have a few questions/comments:

1. Is there a reason why bs_create_opcode_map() is not already used for AIO?
2. Is my understanding of the situation somewhat correct?
3. I just copy-pasted opcodes from bs_rdwr.c's sbc_opcodes[] and
removed the WRITE_SAME* operations because I did not know what other
opcodes the AIO block store supports. This is not more permissive than
what is on master, but a proper patch would include just the opcodes
that are supported...sadly I do not know how to find this out.
4. I did not run unit tests on these changes.

This is my first submission to a mailing list, thank you for your
patience and looking forward to having this issue fixed, either via
this patch or something else entirely.



[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux