PDU use serial32 arithmetic for cmdsn, maxcmdsn and expcmdsn.
RFC3720 says that cmdsn comparison must be done using serial32 arithmetic. This will definetly avoid a deadlock if cmdsn wraps from 2^32-1 to 0. Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
@@ -302,7 +302,7 @@ iscsi_which_events(struct iscsi_context *iscsi)
|
||||
{
|
||||
int events = iscsi->is_connected ? POLLIN : POLLOUT;
|
||||
|
||||
if (iscsi->outqueue && iscsi->outqueue->cmdsn <= iscsi->maxcmdsn) {
|
||||
if (iscsi->outqueue && iscsi_serial32_compare(iscsi->outqueue->cmdsn,iscsi->maxcmdsn) <= 0) {
|
||||
events |= POLLOUT;
|
||||
}
|
||||
return events;
|
||||
@@ -442,7 +442,7 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
|
||||
while (iscsi->outqueue) {
|
||||
ssize_t total;
|
||||
|
||||
if (iscsi->outqueue->cmdsn > iscsi->maxcmdsn) {
|
||||
if (iscsi_serial32_compare(iscsi->outqueue->cmdsn,iscsi->maxcmdsn) > 0) {
|
||||
/* stop sending. maxcmdsn is reached */
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user