Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning fixes for libiscsi #4

Merged
merged 4 commits into from Sep 21, 2011
Merged

warning fixes for libiscsi #4

merged 4 commits into from Sep 21, 2011

Conversation

bonzini
Copy link
Contributor

@bonzini bonzini commented Sep 21, 2011

Hi Ronnie,

please pull a few small fixes for compilation warnings.

sahlberg added a commit that referenced this pull request Sep 21, 2011
warning fixes for libiscsi
@sahlberg sahlberg merged commit ad76510 into sahlberg:master Sep 21, 2011
@sahlberg
Copy link
Owner

Thanks. Merged.

sitsofe pushed a commit to sitsofe/libiscsi that referenced this pull request Sep 19, 2013
@rabishaw rabishaw mentioned this pull request May 25, 2017
pizhenwei added a commit to bytedance/libiscsi that referenced this pull request Feb 28, 2020
Hit segfault at iser_reg_mr during attaching disk with backtrace:
 #0  0x000055ace9635b0f in iser_reg_mr (iser_conn=0x55aceca33820) at iser.c:1060
 sahlberg#1  iser_connected_handler (cma_id=<optimized out>) at iser.c:1300
 sahlberg#2  iser_cma_handler (event=0x7f29ef1f7950, cma_id=<optimized out>, iser_conn=0x55aceca33820) at iser.c:1326
 sahlberg#3  cm_thread (arg=0x55aceca33820) at iser.c:1380
 sahlberg#4  0x00007f2e2c31c4a4 in start_thread (arg=0x7f29ef1f8700) at pthread_create.c:456
 sahlberg#5  0x00007f2e2c05ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
 (gdb) p *iser_conn->tx_desc
 Cannot access memory at address 0x20

This issue can be reproduced easily by attaching several disks of iser
protocol:
 # virsh attach-device stretch iser0.xml
 # virsh attach-device stretch iser1.xml
 ...

Initialize instances with zero to avoid random value pointer.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
neutronsharc pushed a commit to neutronsharc/libiscsi that referenced this pull request Mar 3, 2020
Hit segfault at iser_reg_mr during attaching disk with backtrace:
 #0  0x000055ace9635b0f in iser_reg_mr (iser_conn=0x55aceca33820) at iser.c:1060
 sahlberg#1  iser_connected_handler (cma_id=<optimized out>) at iser.c:1300
 sahlberg#2  iser_cma_handler (event=0x7f29ef1f7950, cma_id=<optimized out>, iser_conn=0x55aceca33820) at iser.c:1326
 sahlberg#3  cm_thread (arg=0x55aceca33820) at iser.c:1380
 sahlberg#4  0x00007f2e2c31c4a4 in start_thread (arg=0x7f29ef1f8700) at pthread_create.c:456
 sahlberg#5  0x00007f2e2c05ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
 (gdb) p *iser_conn->tx_desc
 Cannot access memory at address 0x20

This issue can be reproduced easily by attaching several disks of iser
protocol:
 # virsh attach-device stretch iser0.xml
 # virsh attach-device stretch iser1.xml
 ...

Initialize instances with zero to avoid random value pointer.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
pizhenwei added a commit to bytedance/libiscsi that referenced this pull request Mar 11, 2020
Hit the crash stack:
 #0  iser_initialize_headers (iser_pdu=0x7f1a3404ef50, iser_conn=0x0) at iser.c:514
 sahlberg#1  iscsi_iser_send_pdu (iscsi=0x7f1a3406d700, pdu=0x7f1a3404ef50) at iser.c:714
 sahlberg#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
 sahlberg#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
 sahlberg#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
 sahlberg#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.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
pizhenwei added a commit to bytedance/libiscsi that referenced this pull request Mar 11, 2020
Hit iser hang in rdma_destroy_id with trace:
 #0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
 sahlberg#1  0x00007f96ecbbcbb3 in rdma_destroy_id () from /usr/lib/librdmacm.so.1
 sahlberg#2  0x00005632027311d4 in iser_conn_release (iser_conn=iser_conn@entry=0x7f96d4027440) at iser.c:261
 sahlberg#3  0x0000563202731428 in iscsi_iser_connect (iscsi=0x563205206c70, sa=<optimized out>, ai_family=<optimized out>)
     at iser.c:1516
 sahlberg#4  0x000056320273dd3c in iscsi_connect_async (iscsi=iscsi@entry=0x563205206c70,
     portal=portal@entry=0x563205207084 "210.32.124.205:3260", cb=cb@entry=0x56320272b220 <iscsi_connect_cb>,
     private_data=private_data@entry=0x7f96d4008b00) at socket.c:389
 sahlberg#5  0x000056320272b325 in iscsi_full_connect_async (iscsi=0x563205206c70,
     portal=0x563205207084 "210.32.124.205:3260", lun=1, cb=cb@entry=0x56320272aef0 <iscsi_reconnect_cb>,
     private_data=private_data@entry=0x0) at connect.c:230
 sahlberg#6  0x000056320272b711 in iscsi_reconnect (iscsi=<optimized out>) at connect.c:473
 sahlberg#7  0x00005632026810a8 in iscsi_timed_check_events (opaque=0x563205206ae0) at block/iscsi.c:387

Currently use pthread_cancel to kill cmthread forcefully, cmthread may
exits without rdma_ack_cm_event, then unacknowledged event will be
remained in librdmacm. rdma_destroy_id hangs until uplayer ack all
the cm event.

Using a variable for cmthread to exit gracefully, the main thread can
wait at most 1000ms,

Reconnect iser 100 times with this patch:
84%: wait 0ms
 5%: wait 1~10ms
 9%: wait 11~50ms
 2%: wait 51~1000ms

All of the 100 tests do not hang in rdma_destroy_id any more.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
pizhenwei added a commit to bytedance/libiscsi that referenced this pull request Mar 18, 2020
Hit the crash stack:
 #0  iser_initialize_headers (iser_pdu=0x7f1a3404ef50, iser_conn=0x0) at iser.c:514
 sahlberg#1  iscsi_iser_send_pdu (iscsi=0x7f1a3406d700, pdu=0x7f1a3404ef50) at iser.c:714
 sahlberg#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
 sahlberg#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
 sahlberg#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
 sahlberg#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>
pizhenwei added a commit to bytedance/libiscsi that referenced this pull request Mar 18, 2020
Hit iser hang in rdma_destroy_id with trace:
 #0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
 sahlberg#1  0x00007f96ecbbcbb3 in rdma_destroy_id () from /usr/lib/librdmacm.so.1
 sahlberg#2  0x00005632027311d4 in iser_conn_release (iser_conn=iser_conn@entry=0x7f96d4027440) at iser.c:261
 sahlberg#3  0x0000563202731428 in iscsi_iser_connect (iscsi=0x563205206c70, sa=<optimized out>, ai_family=<optimized out>)
     at iser.c:1516
 sahlberg#4  0x000056320273dd3c in iscsi_connect_async (iscsi=iscsi@entry=0x563205206c70,
     portal=portal@entry=0x563205207084 "210.32.124.205:3260", cb=cb@entry=0x56320272b220 <iscsi_connect_cb>,
     private_data=private_data@entry=0x7f96d4008b00) at socket.c:389
 sahlberg#5  0x000056320272b325 in iscsi_full_connect_async (iscsi=0x563205206c70,
     portal=0x563205207084 "210.32.124.205:3260", lun=1, cb=cb@entry=0x56320272aef0 <iscsi_reconnect_cb>,
     private_data=private_data@entry=0x0) at connect.c:230
 sahlberg#6  0x000056320272b711 in iscsi_reconnect (iscsi=<optimized out>) at connect.c:473
 sahlberg#7  0x00005632026810a8 in iscsi_timed_check_events (opaque=0x563205206ae0) at block/iscsi.c:387

Currently use pthread_cancel to kill cmthread forcefully, cmthread may
exits without rdma_ack_cm_event, then unacknowledged event will be
remained in librdmacm. rdma_destroy_id hangs until uplayer ack all
the cm event.

Since destroying qp, cm thread will handle DISCONNECTED event, and
exits by itself. Joining cm thread to wait cm thread to exit
gracefully.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
bvanassche pushed a commit that referenced this pull request Mar 18, 2020
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 ]
bvanassche pushed a commit that referenced this pull request Mar 18, 2020
Hit iser hang in rdma_destroy_id with trace:
 #0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
 #1  0x00007f96ecbbcbb3 in rdma_destroy_id () from /usr/lib/librdmacm.so.1
 #2  0x00005632027311d4 in iser_conn_release (iser_conn=iser_conn@entry=0x7f96d4027440) at iser.c:261
 #3  0x0000563202731428 in iscsi_iser_connect (iscsi=0x563205206c70, sa=<optimized out>, ai_family=<optimized out>)
     at iser.c:1516
 #4  0x000056320273dd3c in iscsi_connect_async (iscsi=iscsi@entry=0x563205206c70,
     portal=portal@entry=0x563205207084 "210.32.124.205:3260", cb=cb@entry=0x56320272b220 <iscsi_connect_cb>,
     private_data=private_data@entry=0x7f96d4008b00) at socket.c:389
 #5  0x000056320272b325 in iscsi_full_connect_async (iscsi=0x563205206c70,
     portal=0x563205207084 "210.32.124.205:3260", lun=1, cb=cb@entry=0x56320272aef0 <iscsi_reconnect_cb>,
     private_data=private_data@entry=0x0) at connect.c:230
 #6  0x000056320272b711 in iscsi_reconnect (iscsi=<optimized out>) at connect.c:473
 #7  0x00005632026810a8 in iscsi_timed_check_events (opaque=0x563205206ae0) at block/iscsi.c:387

Currently use pthread_cancel to kill cmthread forcefully, cmthread may
exits without rdma_ack_cm_event, then unacknowledged event will be
remained in librdmacm. rdma_destroy_id hangs until uplayer ack all
the cm event.

Since destroying qp, cm thread will handle DISCONNECTED event, and
exits by itself. Joining cm thread to wait cm thread to exit
gracefully.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants