libiscsi: Clear PS bit before sending MODE SELECT

A quote from SPC-4: "When using the MODE SENSE command, a
parameters saveable (PS) bit set to one indicates that the mode
page may be saved by the logical unit in a nonvolatile, vendor
specific location. A PS bit set to zero indicates that the device
server is not able to save the supported parameters. When using
the MODE SELECT command, the PS bit is reserved."

Hence clear the PS bit after having queried a mode page via MODE
SENSE and before changing it via MODE SELECT.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
Bart Van Assche
2014-10-14 11:47:36 +02:00
committed by Ronnie Sahlberg
parent 14461757c4
commit 0763dc5743
2 changed files with 9 additions and 0 deletions

View File

@@ -2461,6 +2461,9 @@ int set_swp(struct scsi_device *sdev)
goto finished;
}
/* For MODE SELECT PS is reserved and hence must be cleared */
mp->ps = 0;
logging(LOG_VERBOSE, "Turn SWP ON");
mp->control.swp = 1;
@@ -2510,6 +2513,9 @@ int clear_swp(struct scsi_device *sdev)
goto finished;
}
/* For MODE SELECT PS is reserved and hence must be cleared */
mp->ps = 0;
logging(LOG_VERBOSE, "Turn SWP OFF");
mp->control.swp = 0;

View File

@@ -206,6 +206,9 @@ int main(int argc, char *argv[])
goto finished;
}
/* For MODE SELECT PS is reserved and hence must be cleared */
mp->ps = 0;
printf("SWP:%d\n", mp->control.swp);
switch (swp) {