|
@@ -247,19 +247,16 @@ static int iscsi_login_zero_tsih_s1(
|
|
|
spin_lock_init(&sess->session_usage_lock);
|
|
|
spin_lock_init(&sess->ttt_lock);
|
|
|
|
|
|
- if (!idr_pre_get(&sess_idr, GFP_KERNEL)) {
|
|
|
- pr_err("idr_pre_get() for sess_idr failed\n");
|
|
|
- iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
|
|
|
- ISCSI_LOGIN_STATUS_NO_RESOURCES);
|
|
|
- kfree(sess);
|
|
|
- return -ENOMEM;
|
|
|
- }
|
|
|
+ idr_preload(GFP_KERNEL);
|
|
|
spin_lock_bh(&sess_idr_lock);
|
|
|
- ret = idr_get_new(&sess_idr, NULL, &sess->session_index);
|
|
|
+ ret = idr_alloc(&sess_idr, NULL, 0, 0, GFP_NOWAIT);
|
|
|
+ if (ret >= 0)
|
|
|
+ sess->session_index = ret;
|
|
|
spin_unlock_bh(&sess_idr_lock);
|
|
|
+ idr_preload_end();
|
|
|
|
|
|
if (ret < 0) {
|
|
|
- pr_err("idr_get_new() for sess_idr failed\n");
|
|
|
+ pr_err("idr_alloc() for sess_idr failed\n");
|
|
|
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
|
|
|
ISCSI_LOGIN_STATUS_NO_RESOURCES);
|
|
|
kfree(sess);
|