First off - thanks a bunch for creating an open, software based iSCSI target 
that supports SCSI-3 PGR.  

Second, I am running snv_93 for the target and open-iscsi on RHEL 4.4 for the 
initiator.

I am having some issues with iscsitgt not correctly honoring a write exclusive, 
registrants only reservation.  Writes are being allowed from an unregistered 
host - I believe they should be conflicting.  It seems to work with an 
exclusive access reservation.

I was able to get /tmp/target-log going so I could see the calls taking place.  
spc_pgr_check() is reporting the correct reservation (write exclusive, ro) but 
it returns an allow.  

The interesting thing is that the writes were coming in as WRITE_G1.  If I look 
at the code for spc_pgr_is_conflicting(), I don't see this command being 
checked.  Based on my reading, it would fall to the default case and be allowed:

     95 /*
     96  * []----
     97  * | spc_pgr_is_conflicting
     98  * |    PGR reservation conflict checking.
     99  * |    SPC-3, Revision 23, Table 31
    100  * []----
    101  */
    102 static int
    103 spc_pgr_is_conflicting(uint8_t *cdb, uint_t type)
    104 {
    105         Boolean_t               conflict = False;
    106 
    107         switch (cdb[0]) {
    108                 case SCMD_FORMAT:
    109                 case SCMD_EXTENDED_COPY:
    110                 case SCMD_LOG_SELECT_G1:
    111                 case SCMD_MODE_SELECT:
    112                 case SCMD_MODE_SELECT_G1:
    113                 case SCMD_MODE_SENSE:
    114                 case SCMD_MODE_SENSE_G1:
    115                 case SCMD_READ_ATTRIBUTE:
    116                 case SCMD_READ_BUFFER:
    117                 case SCMD_GDIAG:        /* 
SCMD_RECEIVE_DIAGNOSTIC_RESULTS */
    118                 case SCMD_SDIAG:        /* SCMD_SEND_DIAGNOSTIC_RESULTS 
*/
    119                 case SCMD_WRITE_ATTRIBUTE:
    120                 case SCMD_WRITE_BUFFER:
    121                         conflict = True;
    122                         break;
    123 
    124                 case SCMD_DOORLOCK:     /* 
SCMD_PREVENT_ALLOW_MEDIA_REMOVAL */
    125                         /*
    126                          * As per SPC-3, Revision 23, Table 31
    127                          * (prevent <> 0)
    128                          */
    129                         conflict = (cdb[4] & 0x1) ? True: False;
    130                         break;
    131 
    132                 case SCMD_MAINTENANCE_IN:       /* SCMD_REPORT_ */
    133                         /*
    134                          * As per SPC-3, Revision 23, Section 6.23
    135                          */
    136                         switch ((cdb[1] & 0x1f)) {
    137                                 /* 
SCMD_REPORT_SUPPORTED_OPERATION_CODES */
    138                                 case 0x0c:
    139                                 /* 
SCMD_REPORT_SUPPORTED_MANAGEMENT_FUNCTIONS */
    140                                 case 0x0d:
    141 
    142                                         conflict = True;
    143                                         break;
    144                         }
    145                         break;
    146 
    147                 case SCMD_MAINTENANCE_OUT:
    148                         /*
    149                          * SPC-3, Revision 23, Section 6.29
    150                          */
    151                         switch ((cdb[1] & 0x1F)) {
    152                                 case SCMD_SET_DEVICE_IDENTIFIER:
    153                                 case SCMD_SET_PRIORITY:
    154                                 case SCMD_SET_TARGET_PORT_GROUPS:
    155                                 case SCMD_SET_TIMESTAMP:
    156                                 conflict = True;
    157                                 break;
    158                         }
    159                         break;
    160 
    161                 case SCMD_READ:
    162                 case SCMD_READ_G1:
    163                 case SCMD_READ_G4:
    164                         /*
    165                          * Exclusive Access, and EA Registrants Only
    166                          */
    167                         if (type == PGR_TYPE_EX_AC || type == 
PGR_TYPE_EX_AC_RO)
    168                                 conflict = True;
    169                         break;
    170         }
    171 
    172         return (conflict);
    173 }

I don't know nearly enough about the SCSI protocol to say that SCMD_WRITE, 
SCMD_WRITE_G1, and SCMD_WRITE_G4 should be added to the case statement at line 
108, but it sure seems that way.

Anybody care to comment?

Thanks,
Dave
 
 
This message posted from opensolaris.org
_______________________________________________
storage-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/storage-discuss

Reply via email to