|
|
| version 1.31, 2007/01/12 15:07:58 | version 1.32, 2007/02/19 14:36:31 |
|---|---|
| Line 519 dm_create_session( | Line 519 dm_create_session( |
| sv_init(&s->sn_readerq, SV_DEFAULT, "dmreadq"); | sv_init(&s->sn_readerq, SV_DEFAULT, "dmreadq"); |
| sv_init(&s->sn_writerq, SV_DEFAULT, "dmwritq"); | sv_init(&s->sn_writerq, SV_DEFAULT, "dmwritq"); |
| spinlock_init(&s->sn_qlock, "sn_qlock"); | spinlock_init(&s->sn_qlock, "sn_qlock"); |
| lc = mutex_spinlock(&dm_session_lock); | |
| } else { | } else { |
| lc = mutex_spinlock(&dm_session_lock); | lc = mutex_spinlock(&dm_session_lock); |
| if ((error = dm_find_session(old, &s)) != 0) { | if ((error = dm_find_session(old, &s)) != 0) { |
| mutex_spinunlock(&dm_session_lock, lc); | mutex_spinunlock(&dm_session_lock, lc); |
| return(error); | return(error); |
| } | } |
| unlink_session(s); | |
| mutex_spinunlock(&dm_session_lock, lc); | |
| #ifdef CONFIG_PROC_FS | #ifdef CONFIG_PROC_FS |
| { | { |
| char buf[100]; | char buf[100]; |
| Line 533 dm_create_session( | Line 534 dm_create_session( |
| remove_proc_entry(buf, NULL); | remove_proc_entry(buf, NULL); |
| } | } |
| #endif | #endif |
| unlink_session(s); | |
| } | } |
| memcpy(s->sn_info, sessinfo, len); | memcpy(s->sn_info, sessinfo, len); |
| s->sn_info[len-1] = 0; /* if not NULL, then now 'tis */ | s->sn_info[len-1] = 0; /* if not NULL, then now 'tis */ |
| s->sn_sessid = sid; | s->sn_sessid = sid; |
| lc = mutex_spinlock(&dm_session_lock); | |
| link_session(s); | link_session(s); |
| mutex_spinunlock(&dm_session_lock, lc); | |
| #ifdef CONFIG_PROC_FS | #ifdef CONFIG_PROC_FS |
| { | { |
| char buf[100]; | char buf[100]; |
| Line 549 dm_create_session( | Line 551 dm_create_session( |
| entry->owner = THIS_MODULE; | entry->owner = THIS_MODULE; |
| } | } |
| #endif | #endif |
| mutex_spinunlock(&dm_session_lock, lc); | |
| return(0); | return(0); |
| } | } |
| Line 584 dm_destroy_session( | Line 585 dm_destroy_session( |
| return(-EBUSY); | return(-EBUSY); |
| } | } |
| /* The session is not in use. Dequeue it from the session chain. */ | |
| unlink_session(s); | |
| nested_spinunlock(&s->sn_qlock); | |
| mutex_spinunlock(&dm_session_lock, lc); | |
| #ifdef CONFIG_PROC_FS | #ifdef CONFIG_PROC_FS |
| { | { |
| char buf[100]; | char buf[100]; |
| Line 592 dm_destroy_session( | Line 599 dm_destroy_session( |
| } | } |
| #endif | #endif |
| /* The session is not in use. Dequeue it from the session chain. */ | |
| unlink_session(s); | |
| nested_spinunlock(&s->sn_qlock); | |
| mutex_spinunlock(&dm_session_lock, lc); | |
| /* Now clear the sessions's disposition registration, and then destroy | /* Now clear the sessions's disposition registration, and then destroy |
| the session structure. | the session structure. |
| */ | */ |