Fix PERSISTENT RESERVE IN / READ RESERVATION response unmarshalling

The code that verifies the pr_type response must compare only the
lower four bits of byte 21 of the response ("TYPE") and must ignore
the upper four bits ("SCOPE").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
Bart Van Assche
2013-05-29 18:06:17 +02:00
committed by Ronnie Sahlberg
parent 0577fa9d66
commit 9dce01bbea
2 changed files with 3 additions and 1 deletions

View File

@@ -803,6 +803,7 @@ struct scsi_persistent_reserve_in_read_reservation {
int reserved;
uint64_t reservation_key;
unsigned char pr_scope;
unsigned char pr_type;
};

View File

@@ -815,7 +815,8 @@ scsi_persistentreservein_datain_unmarshall(struct scsi_task *task)
rr->reserved = 1;
rr->reservation_key =
task_get_uint64(task, 8);
rr->pr_type = task_get_uint8(task, 21) & 0xff;
rr->pr_scope = task_get_uint8(task, 21) >> 4;
rr->pr_type = task_get_uint8(task, 21) & 0xf;
}
return rr;