瀏覽代碼

[CIFS] Fix suspend/resume problem which causes EIO on subsequent access to
the mount.

Signed-off-by: Pavel Machek <pavel@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>

Pavel Machek 19 年之前
父節點
當前提交
0fd1ffe063
共有 2 個文件被更改,包括 13 次插入13 次删除
  1. 1 1
      fs/cifs/cifsfs.c
  2. 12 12
      fs/cifs/connect.c

+ 1 - 1
fs/cifs/cifsfs.c

@@ -905,7 +905,7 @@ static int cifs_dnotify_thread(void * dummyarg)
 	struct cifsSesInfo *ses;
 	struct cifsSesInfo *ses;
 
 
 	do {
 	do {
-		if(try_to_freeze())
+		if (try_to_freeze())
 			continue;
 			continue;
 		set_current_state(TASK_INTERRUPTIBLE);
 		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout(15*HZ);
 		schedule_timeout(15*HZ);

+ 12 - 12
fs/cifs/connect.c

@@ -367,21 +367,21 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
 			continue;
 			continue;
 		if (bigbuf == NULL) {
 		if (bigbuf == NULL) {
 			bigbuf = cifs_buf_get();
 			bigbuf = cifs_buf_get();
-			if(bigbuf == NULL) {
-				cERROR(1,("No memory for large SMB response"));
+			if (!bigbuf) {
+				cERROR(1, ("No memory for large SMB response"));
 				msleep(3000);
 				msleep(3000);
 				/* retry will check if exiting */
 				/* retry will check if exiting */
 				continue;
 				continue;
 			}
 			}
-		} else if(isLargeBuf) {
-			/* we are reusing a dirtry large buf, clear its start */
+		} else if (isLargeBuf) {
+			/* we are reusing a dirty large buf, clear its start */
 			memset(bigbuf, 0, sizeof (struct smb_hdr));
 			memset(bigbuf, 0, sizeof (struct smb_hdr));
 		}
 		}
 
 
 		if (smallbuf == NULL) {
 		if (smallbuf == NULL) {
 			smallbuf = cifs_small_buf_get();
 			smallbuf = cifs_small_buf_get();
-			if(smallbuf == NULL) {
-				cERROR(1,("No memory for SMB response"));
+			if (!smallbuf) {
+				cERROR(1, ("No memory for SMB response"));
 				msleep(1000);
 				msleep(1000);
 				/* retry will check if exiting */
 				/* retry will check if exiting */
 				continue;
 				continue;
@@ -401,12 +401,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
 		    kernel_recvmsg(csocket, &smb_msg,
 		    kernel_recvmsg(csocket, &smb_msg,
 				 &iov, 1, 4, 0 /* BB see socket.h flags */);
 				 &iov, 1, 4, 0 /* BB see socket.h flags */);
 
 
-		if(server->tcpStatus == CifsExiting) {
+		if (server->tcpStatus == CifsExiting) {
 			break;
 			break;
 		} else if (server->tcpStatus == CifsNeedReconnect) {
 		} else if (server->tcpStatus == CifsNeedReconnect) {
-			cFYI(1,("Reconnect after server stopped responding"));
+			cFYI(1, ("Reconnect after server stopped responding"));
 			cifs_reconnect(server);
 			cifs_reconnect(server);
-			cFYI(1,("call to reconnect done"));
+			cFYI(1, ("call to reconnect done"));
 			csocket = server->ssocket;
 			csocket = server->ssocket;
 			continue;
 			continue;
 		} else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) {
 		} else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) {
@@ -415,15 +415,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
 				tcpStatus CifsNeedReconnect if server hung */
 				tcpStatus CifsNeedReconnect if server hung */
 			continue;
 			continue;
 		} else if (length <= 0) {
 		} else if (length <= 0) {
-			if(server->tcpStatus == CifsNew) {
-				cFYI(1,("tcp session abend after SMBnegprot"));
+			if (server->tcpStatus == CifsNew) {
+				cFYI(1, ("tcp session abend after SMBnegprot"));
 				/* some servers kill the TCP session rather than
 				/* some servers kill the TCP session rather than
 				   returning an SMB negprot error, in which
 				   returning an SMB negprot error, in which
 				   case reconnecting here is not going to help,
 				   case reconnecting here is not going to help,
 				   and so simply return error to mount */
 				   and so simply return error to mount */
 				break;
 				break;
 			}
 			}
-			if(length == -EINTR) { 
+			if (!try_to_freeze() && (length == -EINTR)) {
 				cFYI(1,("cifsd thread killed"));
 				cFYI(1,("cifsd thread killed"));
 				break;
 				break;
 			}
 			}