Message ID | 1496494172.27407.325.camel@haakon3.risingtidesystems.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sat, 2017-06-03 at 05:49 -0700, Nicholas A. Bellinger wrote: > In any event, here's how to simulate the issue, and the proper fix to > just let existing iscsit_close_connection() logic clean up the failed > logout as if iscsit_logout_post_handler_closesession() was never > reached. Hello Nic, With the quick tests I ran so far this patch seems to be sufficient to avoid that "kernel BUG at drivers/target/iscsi/iscsi_target.c:4346" gets reported. Bart.-- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 2017-06-06 at 18:31 +0000, Bart Van Assche wrote: > On Sat, 2017-06-03 at 05:49 -0700, Nicholas A. Bellinger wrote: > > In any event, here's how to simulate the issue, and the proper fix to > > just let existing iscsit_close_connection() logic clean up the failed > > logout as if iscsit_logout_post_handler_closesession() was never > > reached. > > Hello Nic, > > With the quick tests I ran so far this patch seems to be sufficient to avoid that > "kernel BUG at drivers/target/iscsi/iscsi_target.c:4346" gets reported. Also, thanks for confirming. Added your 'Tested-by' to the patch as well. Likewise, this patch has been run through the paces by DATERA's Q/A team as well. -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 0d8f815..03a0224 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -4414,6 +4414,11 @@ static void iscsit_logout_post_handler_closesession( { struct iscsi_session *sess = conn->sess; int sleep = 1; + + printk("Simulating broken out-of-tree codebase.\n"); + ssleep(SECONDS_FOR_LOGOUT_COMP + 2); + printk("Simulation complete\n"); + /* * Traditional iscsi/tcp will invoke this logic from TX thread * context during session logout, so clear tx_thread_active and @@ -4423,8 +4428,11 @@ static void iscsit_logout_post_handler_closesession( * always sleep waiting for RX/TX thread shutdown to complete * within iscsit_close_connection(). */ - if (!conn->conn_transport->rdma_shutdown) + if (!conn->conn_transport->rdma_shutdown) { sleep = cmpxchg(&conn->tx_thread_active, true, false); + if (!sleep) + return; + } atomic_set(&conn->conn_logout_remove, 0); complete(&conn->conn_logout_comp); @@ -4440,8 +4448,11 @@ static void iscsit_logout_post_handler_samecid( { int sleep = 1; - if (!conn->conn_transport->rdma_shutdown) + if (!conn->conn_transport->rdma_shutdown) { sleep = cmpxchg(&conn->tx_thread_active, true, false); + if (!sleep) + return; + } atomic_set(&conn->conn_logout_remove, 0); complete(&conn->conn_logout_comp);