Skip to content

Instantly share code, notes, and snippets.

@ymmt2005
Created January 14, 2013 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ymmt2005/4528252 to your computer and use it in GitHub Desktop.
Save ymmt2005/4528252 to your computer and use it in GitHub Desktop.
A patch for Linux LIO iSCSI target to restrict the maximum number of sessions (not connections).
--- linux-3.2.0/drivers/target/iscsi/iscsi_target_login.c 2012-06-07 05:37:34.000000000 +0000
+++ iscsi_target_login.c 2012-06-07 05:34:22.866487169 +0000
@@ -1107,6 +1107,20 @@
goto new_sess_out;
}
+ /* Cybozu */
+ if (zero_tsih) {
+ int error = 0;
+ spin_lock_bh(&np->np_thread_lock);
+ if( tpg->nsessions > 0 )
+ error = 1;
+ spin_unlock_bh(&np->np_thread_lock);
+
+ if( error ) {
+ pr_err("Detected possible split brain\n");
+ goto new_sess_out;
+ }
+ }
+
if (zero_tsih) {
if (iscsi_login_zero_tsih_s2(conn) < 0) {
iscsi_target_nego_release(login, conn);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment