svn commit: linux-cifs-client r103 - in branches/linux-converged-for-old-kernels/fs/cifs: .

sfrench at samba.org sfrench at samba.org
Thu Feb 8 18:16:42 GMT 2007


Author: sfrench
Date: 2007-02-08 18:16:41 +0000 (Thu, 08 Feb 2007)
New Revision: 103

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=linux-cifs-client&rev=103

Log:
mege with git

Modified:
   branches/linux-converged-for-old-kernels/fs/cifs/cifsproto.h
   branches/linux-converged-for-old-kernels/fs/cifs/file.c
   branches/linux-converged-for-old-kernels/fs/cifs/inode.c
   branches/linux-converged-for-old-kernels/fs/cifs/readdir.c


Changeset:
Modified: branches/linux-converged-for-old-kernels/fs/cifs/cifsproto.h
===================================================================
--- branches/linux-converged-for-old-kernels/fs/cifs/cifsproto.h	2007-02-08 18:15:57 UTC (rev 102)
+++ branches/linux-converged-for-old-kernels/fs/cifs/cifsproto.h	2007-02-08 18:16:41 UTC (rev 103)
@@ -70,7 +70,7 @@
 extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid);
 extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length);
 extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *);
-extern int is_size_safe_to_change(struct cifsInodeInfo *);
+extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
 extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *);
 extern unsigned int smbCalcSize(struct smb_hdr *ptr);
 extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr);

Modified: branches/linux-converged-for-old-kernels/fs/cifs/file.c
===================================================================
--- branches/linux-converged-for-old-kernels/fs/cifs/file.c	2007-02-08 18:15:57 UTC (rev 102)
+++ branches/linux-converged-for-old-kernels/fs/cifs/file.c	2007-02-08 18:16:41 UTC (rev 103)
@@ -2050,7 +2050,7 @@
    refreshing the inode only on increases in the file size 
    but this is tricky to do without racing with writebehind
    page caching in the current Linux kernel design */
-int is_size_safe_to_change(struct cifsInodeInfo *cifsInode)
+int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file)
 {
 	struct cifsFileInfo *open_file = NULL;
 
@@ -2075,6 +2075,9 @@
 			return 1;
 		}
 
+		if(i_size_read(&cifsInode->vfs_inode) < end_of_file)
+			return 1;
+
 		return 0;
 	} else
 		return 1;

Modified: branches/linux-converged-for-old-kernels/fs/cifs/inode.c
===================================================================
--- branches/linux-converged-for-old-kernels/fs/cifs/inode.c	2007-02-08 18:15:57 UTC (rev 102)
+++ branches/linux-converged-for-old-kernels/fs/cifs/inode.c	2007-02-08 18:16:41 UTC (rev 103)
@@ -143,7 +143,7 @@
 		inode->i_gid = le64_to_cpu(findData.Gid);
 		inode->i_nlink = le64_to_cpu(findData.Nlinks);
 
-		if (is_size_safe_to_change(cifsInfo)) {
+		if (is_size_safe_to_change(cifsInfo, end_of_file)) {
 		/* can not safely change the file size here if the
 		   client is writing to it due to potential races */
 			i_size_write(inode, end_of_file);
@@ -494,8 +494,8 @@
 		/* BB add code here -
 		   validate if device or weird share or device type? */
 		}
-		if (is_size_safe_to_change(cifsInfo)) {
-			/* can not safely change the file size here if the
+		if (is_size_safe_to_change(cifsInfo, le64_to_cpu(pfindData->EndOfFile))) {
+			/* can not safely shrink the file size here if the
 			   client is writing to it due to potential races */
 			i_size_write(inode,le64_to_cpu(pfindData->EndOfFile));
 

Modified: branches/linux-converged-for-old-kernels/fs/cifs/readdir.c
===================================================================
--- branches/linux-converged-for-old-kernels/fs/cifs/readdir.c	2007-02-08 18:15:57 UTC (rev 102)
+++ branches/linux-converged-for-old-kernels/fs/cifs/readdir.c	2007-02-08 18:16:41 UTC (rev 103)
@@ -239,7 +239,7 @@
 		atomic_set(&cifsInfo->inUse, 1);
 	}
 
-	if (is_size_safe_to_change(cifsInfo)) {
+	if (is_size_safe_to_change(cifsInfo, end_of_file)) {
 		/* can not safely change the file size here if the 
 		client is writing to it due to potential races */
 		i_size_write(tmp_inode, end_of_file);
@@ -372,10 +372,10 @@
 	tmp_inode->i_gid = le64_to_cpu(pfindData->Gid);
 	tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks);
 
-	if (is_size_safe_to_change(cifsInfo)) {
+	if (is_size_safe_to_change(cifsInfo, end_of_file)) {
 		/* can not safely change the file size here if the 
 		client is writing to it due to potential races */
-		i_size_write(tmp_inode,end_of_file);
+		i_size_write(tmp_inode, end_of_file);
 
 	/* 512 bytes (2**9) is the fake blocksize that must be used */
 	/* for this calculation, not the real blocksize */



More information about the samba-cvs mailing list