Page MenuHomeFreeBSD

iscsi: do not hold the global lock while tearing down a session
ClosedPublic

Authored by avg on Oct 13 2017, 11:52 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 22 2023, 10:32 PM
Unknown Object (File)
Jul 6 2023, 12:51 AM
Unknown Object (File)
Jun 15 2023, 6:45 PM
Unknown Object (File)
Jun 10 2023, 6:48 PM
Unknown Object (File)
Jun 3 2023, 1:35 AM
Unknown Object (File)
May 17 2023, 5:14 PM
Unknown Object (File)
Jan 3 2023, 4:55 PM
Subscribers

Details

Summary

In general, it should be sufficient to hold the lock just for removing
the session from the ssesion list. For everything else the session specific
lock should sufficient.
On top of that, at present we can get a deadlock caused by waiting on
the CAM SIM reference count while holding the global lock.
A specific scenario involving ZFS is this:

  • session S1 completed all I/Os and sleeps in CAM waiting for device close by ZFS;
  • session S2 is also dead now, but can not forcefully complete outstanding requests by calling iscsi_session_cleanup() from iscsi_maintenance_thread_terminate(), since it can't get the same global sc_lock;
  • as soon as there are unfinished requests, ZFS can not do spa_config_enter() as writer, and so can not close the device for session S1
  • deadlock.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Assuming it fixes the problem - looks good :-)

This revision is now accepted and ready to land.Oct 13 2017, 4:55 PM
This revision was automatically updated to reflect the committed changes.