iser: fix crash for sending pdi during reconnecting
Hit the crash stack: #0 iser_initialize_headers (iser_pdu=0x7f1a3404ef50, iser_conn=0x0) at iser.c:514 #1 iscsi_iser_send_pdu (iscsi=0x7f1a3406d700, pdu=0x7f1a3404ef50) at iser.c:714 #2 0x000055e3160f0157 in iscsi_scsi_command_async (iscsi=0x7f1a3406d700, iscsi@entry=0x55e317fbcc70, lun=lun@entry=1, task=task@entry=0x7f1a34026610, cb=cb@entry=0x55e316044c10 <iscsi_co_generic_cb>, d=d@entry=0x7f15feeb7710, private_data=private_data@entry=0x7f15feeb77e0) at iscsi-command.c:282 #3 0x000055e3160f1616 in iscsi_write10_iov_task (iscsi=0x55e317fbcc70, lun=1, lba=lba@entry=10401896, data=data@entry=0x0, datalen=4096, blocksize=<optimized out>, wrprotect=0, dpo=0, fua=0, fua_nv=0, group_number=0, cb=0x55e316044c10 <iscsi_co_generic_cb>, private_data=0x7f15feeb77e0, iov=0x7f1a34042090, niov=1) at iscsi-command.c:1107 #4 0x000055e31604680f in iscsi_co_writev (bs=<optimized out>, sector_num=<optimized out>, nb_sectors=<optimized out>, iov=0x7f1a3404e380, flags=<optimized out>) at block/iscsi.c:640 #5 0x000055e31601e89c in bdrv_driver_pwritev (bs=bs@entry=0x55e317fb6570, offset=offset@entry=5325770752, bytes=bytes@entry=4096, qiov=qiov@entry=0x7f1a3404e380, qiov_offset=qiov_offset@entry=0, flags=flags@entry=0) at block/io.c:1220 The reason is that during async reconnection, before reconnecting call back function gets woked, we have closed the old connection, and the new connection is not ready. At the same time, up layer still sends pdu to the old iscsi context. In this patch, before reconnecting successfully, just add the pdu to waitpdu without sending. Suggested by Bart, do not show iser related log here. Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> [ bvanassche: reformatted patch ]
This commit is contained in:
committed by
Bart Van Assche
parent
37fb15e8eb
commit
dcf95f9780
@@ -711,6 +711,13 @@ iscsi_iser_send_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) {
|
||||
iscsi_pdu_set_expstatsn(pdu, iscsi->statsn + 1);
|
||||
ISCSI_LIST_ADD_END(&iscsi->waitpdu, pdu);
|
||||
|
||||
/*
|
||||
* because of async reconnection, before reconnecting successfully,
|
||||
* the argument 'iscsi' is the 'old_iscsi' with a empty connection.
|
||||
*/
|
||||
if (!iser_conn)
|
||||
return 0;
|
||||
|
||||
if (iser_initialize_headers(iser_pdu, iser_conn)) {
|
||||
iscsi_set_error(iscsi, "initialize headers Failed\n");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user