Message ID | 1597749370-631500-1-git-send-email-wubo40@huawei.com (mailing list archive) |
---|---|
State | Deferred |
Headers | show |
Series | target:iscsi-target:Fix null pointer access while logout the iscsi session | expand |
Hi, On Tue, 18 Aug 2020 19:16:10 +0800, Wu Bo wrote: > From: Wu Bo <wubo40@huawei.com> > > When I use fio to test the iscsi volumes and logout of the iscsi session > at the same time, the following crash occurs: The change looks reasonable here, but I'd like get a reproducer for it. I've attempted something via: https://github.com/ddiss/libiscsi/tree/async_logout_during_write (run iscsi-test-cu --test iSCSI.iSCSITMF.LogoutDuringIOAsync) Do you have any ideas why I'm not able to hit this oops? Thanks, David
On 2020/8/18 22:11, David Disseldorp wrote: > Hi, > > On Tue, 18 Aug 2020 19:16:10 +0800, Wu Bo wrote: > >> From: Wu Bo <wubo40@huawei.com> >> >> When I use fio to test the iscsi volumes and logout of the iscsi session >> at the same time, the following crash occurs: > > The change looks reasonable here, but I'd like get a reproducer for it. > I've attempted something via: > https://github.com/ddiss/libiscsi/tree/async_logout_during_write > (run iscsi-test-cu --test iSCSI.iSCSITMF.LogoutDuringIOAsync) > > Do you have any ideas why I'm not able to hit this oops? > > Thanks, David > > . > Hi, This is more difficult to reproduce it, I found that the upstream already has a similar solution. commit: e9d3009cb936bd0faf0719f68d98ad8afb1e613b scsi: target: iscsi: Wait for all commands to finish before freeing a session. Thanks, Wu Bo
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index c968961..a8ea4a7 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -4387,6 +4387,8 @@ int iscsit_close_session(struct iscsi_session *sess) } } + target_sess_cmd_list_set_waiting(sess->se_sess); + target_wait_for_sess_cmds(sess->se_sess); transport_deregister_session(sess->se_sess); if (sess->sess_ops->ErrorRecoveryLevel == 2)