Pārlūkot izejas kodu

CIFS: Allow wsize to exceed CIFSMaxBufSize

This allows cifs_writepages to send data in larger chunks from the page
cache, without requiring larger memory allocations in other cases.

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Steve French 19 gadi atpakaļ
vecāks
revīzija
4a77118cd5
3 mainītis faili ar 10 papildinājumiem un 16 dzēšanām
  1. 1 1
      fs/cifs/connect.c
  2. 8 0
      fs/cifs/file.c
  3. 1 15
      fs/cifs/transport.c

+ 1 - 1
fs/cifs/connect.c

@@ -1740,7 +1740,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
 			cifs_sb->rsize = volume_info.rsize;
 			cifs_sb->rsize = volume_info.rsize;
 		else
 		else
 			cifs_sb->rsize = srvTcp->maxBuf - MAX_CIFS_HDR_SIZE; /* default */
 			cifs_sb->rsize = srvTcp->maxBuf - MAX_CIFS_HDR_SIZE; /* default */
-		if((volume_info.wsize) && (volume_info.wsize <= CIFSMaxBufSize))
+		if(volume_info.wsize)
 			cifs_sb->wsize = volume_info.wsize;
 			cifs_sb->wsize = volume_info.wsize;
 		else
 		else
 			cifs_sb->wsize = CIFSMaxBufSize; /* default */
 			cifs_sb->wsize = CIFSMaxBufSize; /* default */

+ 8 - 0
fs/cifs/file.c

@@ -925,6 +925,7 @@ static struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
 				/* if it fails, try another handle - might be */
 				/* if it fails, try another handle - might be */
 				/* dangerous to hold up writepages with retry */
 				/* dangerous to hold up writepages with retry */
 				if(rc) {
 				if(rc) {
+					cFYI(1,("failed on reopen file in wp"));
 					read_lock(&GlobalSMBSeslock);
 					read_lock(&GlobalSMBSeslock);
 					continue;
 					continue;
 				}
 				}
@@ -1028,6 +1029,13 @@ static int cifs_writepages(struct address_space *mapping,
 	if (cifs_sb->wsize < PAGE_CACHE_SIZE)
 	if (cifs_sb->wsize < PAGE_CACHE_SIZE)
 		return generic_writepages(mapping, wbc);
 		return generic_writepages(mapping, wbc);
 
 
+	/* BB FIXME we do not have code to sign across multiple buffers yet,
+	   so go to older writepage style write which we can sign if needed */
+	if((cifs_sb->tcon->ses) && (cifs_sb->tcon->ses->server))
+		if(cifs_sb->tcon->ses->server->secMode &
+                          (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
+			return generic_writepages(mapping, wbc);
+
 	/*
 	/*
 	 * BB: Is this meaningful for a non-block-device file system?
 	 * BB: Is this meaningful for a non-block-device file system?
 	 * If it is, we should test it again after we do I/O
 	 * If it is, we should test it again after we do I/O

+ 1 - 15
fs/cifs/transport.c

@@ -361,22 +361,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
 		return -ENOMEM;
 		return -ENOMEM;
 	}
 	}
 
 
-	if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
-		up(&ses->server->tcpSem);
-		cERROR(1,
-		       ("Illegal length, greater than maximum frame, %d ",
-			in_buf->smb_buf_length));
-		DeleteMidQEntry(midQ);
-		/* If not lock req, update # of requests on wire to server */
-		if(long_op < 3) {
-			atomic_dec(&ses->server->inFlight); 
-			wake_up(&ses->server->request_q);
-		}
-		return -EIO;
-	}
-
 /* BB FIXME */
 /* BB FIXME */
-/* 	rc = cifs_sign_smb2(in_buf, data, ses->server, &midQ->sequence_number); */
+/* 	rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number); */
 
 
 	midQ->midState = MID_REQUEST_SUBMITTED;
 	midQ->midState = MID_REQUEST_SUBMITTED;
 	rc = smb_send2(ses->server->ssocket, iov, n_vec,
 	rc = smb_send2(ses->server->ssocket, iov, n_vec,