Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117581
b: refs/heads/master
c: 469ee61
h: refs/heads/master
i:
  117579: a948bf8
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Oct 16, 2008
1 parent 74212d9 commit 918717c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2c1b861539c15491593625920058e06452cd3747
refs/heads/master: 469ee614aaa367d9cde01cbdd2027212f56c6cc6
44 changes: 15 additions & 29 deletions trunk/fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
struct mid_q_entry *mid_entry;

spin_lock(&GlobalMid_Lock);
if (kthread_should_stop()) {
if (server->tcpStatus == CifsExiting) {
/* the demux thread will exit normally
next time through the loop */
spin_unlock(&GlobalMid_Lock);
Expand Down Expand Up @@ -185,7 +185,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
spin_unlock(&GlobalMid_Lock);
up(&server->tcpSem);

while ((!kthread_should_stop()) && (server->tcpStatus != CifsGood)) {
while ((server->tcpStatus != CifsExiting) &&
(server->tcpStatus != CifsGood)) {
try_to_freeze();
if (server->protocolType == IPV6) {
rc = ipv6_connect(&server->addr.sockAddr6,
Expand All @@ -202,7 +203,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
} else {
atomic_inc(&tcpSesReconnectCount);
spin_lock(&GlobalMid_Lock);
if (!kthread_should_stop())
if (server->tcpStatus != CifsExiting)
server->tcpStatus = CifsGood;
server->sequence_number = 0;
spin_unlock(&GlobalMid_Lock);
Expand Down Expand Up @@ -357,7 +358,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
GFP_KERNEL);

set_freezable();
while (!kthread_should_stop()) {
while (server->tcpStatus != CifsExiting) {
if (try_to_freeze())
continue;
if (bigbuf == NULL) {
Expand Down Expand Up @@ -398,7 +399,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
kernel_recvmsg(csocket, &smb_msg,
&iov, 1, pdu_length, 0 /* BB other flags? */);

if (kthread_should_stop()) {
if (server->tcpStatus == CifsExiting) {
break;
} else if (server->tcpStatus == CifsNeedReconnect) {
cFYI(1, ("Reconnect after server stopped responding"));
Expand Down Expand Up @@ -523,7 +524,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
total_read += length) {
length = kernel_recvmsg(csocket, &smb_msg, &iov, 1,
pdu_length - total_read, 0);
if (kthread_should_stop() ||
if ((server->tcpStatus == CifsExiting) ||
(length == -EINTR)) {
/* then will exit */
reconnect = 2;
Expand Down Expand Up @@ -652,14 +653,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
spin_unlock(&GlobalMid_Lock);
wake_up_all(&server->response_q);

/* don't exit until kthread_stop is called */
set_current_state(TASK_UNINTERRUPTIBLE);
while (!kthread_should_stop()) {
schedule();
set_current_state(TASK_UNINTERRUPTIBLE);
}
set_current_state(TASK_RUNNING);

/* check if we have blocked requests that need to free */
/* Note that cifs_max_pending is normally 50, but
can be set at module install time to as little as two */
Expand Down Expand Up @@ -2234,14 +2227,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
spin_lock(&GlobalMid_Lock);
srvTcp->tcpStatus = CifsExiting;
spin_unlock(&GlobalMid_Lock);
if (srvTcp->tsk) {
/* If we could verify that kthread_stop would
always wake up processes blocked in
tcp in recv_mesg then we could remove the
send_sig call */
force_sig(SIGKILL, srvTcp->tsk);
kthread_stop(srvTcp->tsk);
}
force_sig(SIGKILL, srvTcp->tsk);
}
/* If find_unc succeeded then rc == 0 so we can not end */
if (tcon) /* up accidently freeing someone elses tcon struct */
Expand All @@ -2255,18 +2241,18 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
/* if the socketUseCount is now zero */
if ((temp_rc == -ESHUTDOWN) &&
(pSesInfo->server) &&
(pSesInfo->server->tsk)) {
(pSesInfo->server->tsk))
force_sig(SIGKILL,
pSesInfo->server->tsk);
kthread_stop(pSesInfo->server->tsk);
}
} else {
cFYI(1, ("No session or bad tcon"));
if ((pSesInfo->server) &&
(pSesInfo->server->tsk)) {
spin_lock(&GlobalMid_Lock);
srvTcp->tcpStatus = CifsExiting;
spin_unlock(&GlobalMid_Lock);
force_sig(SIGKILL,
pSesInfo->server->tsk);
kthread_stop(pSesInfo->server->tsk);
}
}
sesInfoFree(pSesInfo);
Expand Down Expand Up @@ -3577,10 +3563,8 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
return 0;
} else if (rc == -ESHUTDOWN) {
cFYI(1, ("Waking up socket by sending signal"));
if (cifsd_task) {
if (cifsd_task)
force_sig(SIGKILL, cifsd_task);
kthread_stop(cifsd_task);
}
rc = 0;
} /* else - we have an smb session
left on this socket do not kill cifsd */
Expand Down Expand Up @@ -3710,7 +3694,9 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
cERROR(1, ("Send error in SessSetup = %d", rc));
} else {
cFYI(1, ("CIFS Session Established successfully"));
spin_lock(&GlobalMid_Lock);
pSesInfo->status = CifsGood;
spin_unlock(&GlobalMid_Lock);
}

ss_err_exit:
Expand Down

0 comments on commit 918717c

Please sign in to comment.