diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-01-11 07:24:01 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-01-19 12:52:30 -0500 |
commit | 9d78315b03fc91228306db42edc533efa69cb518 (patch) | |
tree | a68f2e8c812309a361fd1fa7b2ceeff877d3133c | |
parent | 941b853d779de3298e39f1eb4e252984464eaea8 (diff) |
cifs: no need to mark smb_ses_list as cifs_demultiplex_thread is exiting
The TCP_Server_Info is refcounted and every SMB session holds a
reference to it. Thus, smb_ses_list is always going to be empty when
cifsd is coming down. This is dead code.
Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
Reviewed-by: Pavel Shilovsky <piastryyy@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | fs/cifs/connect.c | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 9f59887badd2..75b538f50b12 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -346,7 +346,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
346 | struct kvec iov; | 346 | struct kvec iov; |
347 | struct socket *csocket = server->ssocket; | 347 | struct socket *csocket = server->ssocket; |
348 | struct list_head *tmp; | 348 | struct list_head *tmp; |
349 | struct cifsSesInfo *ses; | ||
350 | struct task_struct *task_to_wake = NULL; | 349 | struct task_struct *task_to_wake = NULL; |
351 | struct mid_q_entry *mid_entry; | 350 | struct mid_q_entry *mid_entry; |
352 | char temp; | 351 | char temp; |
@@ -677,44 +676,19 @@ multi_t2_fnd: | |||
677 | if (smallbuf) /* no sense logging a debug message if NULL */ | 676 | if (smallbuf) /* no sense logging a debug message if NULL */ |
678 | cifs_small_buf_release(smallbuf); | 677 | cifs_small_buf_release(smallbuf); |
679 | 678 | ||
680 | /* | 679 | if (!list_empty(&server->pending_mid_q)) { |
681 | * BB: we shouldn't have to do any of this. It shouldn't be | ||
682 | * possible to exit from the thread with active SMB sessions | ||
683 | */ | ||
684 | spin_lock(&cifs_tcp_ses_lock); | ||
685 | if (list_empty(&server->pending_mid_q)) { | ||
686 | /* loop through server session structures attached to this and | ||
687 | mark them dead */ | ||
688 | list_for_each(tmp, &server->smb_ses_list) { | ||
689 | ses = list_entry(tmp, struct cifsSesInfo, | ||
690 | smb_ses_list); | ||
691 | ses->status = CifsExiting; | ||
692 | ses->server = NULL; | ||
693 | } | ||
694 | spin_unlock(&cifs_tcp_ses_lock); | ||
695 | } else { | ||
696 | /* although we can not zero the server struct pointer yet, | ||
697 | since there are active requests which may depnd on them, | ||
698 | mark the corresponding SMB sessions as exiting too */ | ||
699 | list_for_each(tmp, &server->smb_ses_list) { | ||
700 | ses = list_entry(tmp, struct cifsSesInfo, | ||
701 | smb_ses_list); | ||
702 | ses->status = CifsExiting; | ||
703 | } | ||
704 | |||
705 | spin_lock(&GlobalMid_Lock); | 680 | spin_lock(&GlobalMid_Lock); |
706 | list_for_each(tmp, &server->pending_mid_q) { | 681 | list_for_each(tmp, &server->pending_mid_q) { |
707 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); | 682 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); |
708 | if (mid_entry->midState == MID_REQUEST_SUBMITTED) { | 683 | if (mid_entry->midState == MID_REQUEST_SUBMITTED) { |
709 | cFYI(1, "Clearing Mid 0x%x - waking up ", | 684 | cFYI(1, "Clearing Mid 0x%x - waking up ", |
710 | mid_entry->mid); | 685 | mid_entry->mid); |
711 | task_to_wake = mid_entry->tsk; | 686 | task_to_wake = mid_entry->tsk; |
712 | if (task_to_wake) | 687 | if (task_to_wake) |
713 | wake_up_process(task_to_wake); | 688 | wake_up_process(task_to_wake); |
714 | } | 689 | } |
715 | } | 690 | } |
716 | spin_unlock(&GlobalMid_Lock); | 691 | spin_unlock(&GlobalMid_Lock); |
717 | spin_unlock(&cifs_tcp_ses_lock); | ||
718 | /* 1/8th of sec is more than enough time for them to exit */ | 692 | /* 1/8th of sec is more than enough time for them to exit */ |
719 | msleep(125); | 693 | msleep(125); |
720 | } | 694 | } |
@@ -732,18 +706,6 @@ multi_t2_fnd: | |||
732 | coming home not much else we can do but free the memory */ | 706 | coming home not much else we can do but free the memory */ |
733 | } | 707 | } |
734 | 708 | ||
735 | /* last chance to mark ses pointers invalid | ||
736 | if there are any pointing to this (e.g | ||
737 | if a crazy root user tried to kill cifsd | ||
738 | kernel thread explicitly this might happen) */ | ||
739 | /* BB: This shouldn't be necessary, see above */ | ||
740 | spin_lock(&cifs_tcp_ses_lock); | ||
741 | list_for_each(tmp, &server->smb_ses_list) { | ||
742 | ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list); | ||
743 | ses->server = NULL; | ||
744 | } | ||
745 | spin_unlock(&cifs_tcp_ses_lock); | ||
746 | |||
747 | kfree(server->hostname); | 709 | kfree(server->hostname); |
748 | task_to_wake = xchg(&server->tsk, NULL); | 710 | task_to_wake = xchg(&server->tsk, NULL); |
749 | kfree(server); | 711 | kfree(server); |