PR REGISTER problem

23 views
Skip to first unread message

Gera Kazakov

unread,
Sep 6, 2013, 1:13:31 PM9/6/13
to linux-iscsi...@googlegroups.com
Hello Nicholas,

I've discovered a problem in PERSISTENT RESERVE OUT / REGISTER command - it does register the key but it completes with Not Ready status:

# sg_persist -v -n --out --register --param-sark=12345678 /dev/sdf
    Persistent Reservation Out cmd: 5f 00 00 00 00 00 00 00 18 00
persistent reserve out:  Fixed format, current;  Sense key: Not Ready
 Additional sense: Logical unit communication failure
PR out: command failed

# cat /sys/kernel/config/target/core/iblock_0/Disk0/pr/*
APTPL Bit Status: Disabled
Ready to process PR APTPL metadata..
No SPC-3 Reservation holder
No SPC-3 Reservation holder
0x00000004
No SPC-3 Reservation holder
SPC-3 PR Registrations:
loopback Node: naa.60014051da352e5f,i,0x Key: 0x0000000012345678 PRgen: 0x00000003
No SPC-3 Reservation holder
SPC3_PERSISTENT_RESERVATIONS


This small patch (taken against vanilla 3.11 sources) fixes the problem

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index bd78faf..adec5a8 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -1949,7 +1949,7 @@ static int __core_scsi3_write_aptpl_to_file(
                pr_debug("Error writing APTPL metadata file: %s\n", path);
        fput(file);

-       return ret ? -EIO : 0;
+       return (ret < 0) ? -EIO : 0;
 }

 
It seems to me that there also is another problem - if  the PERSISTENT RESERVE OUT / REGISTER successfully registers a key but the __core_scsi3_write_aptpl_to_file really fails then correct error status would be returned to the host however key registration would not be reverted.


Gera.





Reply all
Reply to author
Forward
0 new messages