svn commit: linux-cifs-client r102 - in branches/linux-2.6-cifs-git-devel/fs/cifs: .

sfrench at samba.org sfrench at samba.org
Thu Feb 8 18:15:59 GMT 2007


Author: sfrench
Date: 2007-02-08 18:15:57 +0000 (Thu, 08 Feb 2007)
New Revision: 102

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

Log:
merge with git

Modified:
   branches/linux-2.6-cifs-git-devel/fs/cifs/CHANGES
   branches/linux-2.6-cifs-git-devel/fs/cifs/cifspdu.h
   branches/linux-2.6-cifs-git-devel/fs/cifs/cifsproto.h
   branches/linux-2.6-cifs-git-devel/fs/cifs/file.c
   branches/linux-2.6-cifs-git-devel/fs/cifs/inode.c
   branches/linux-2.6-cifs-git-devel/fs/cifs/readdir.c


Changeset:
Modified: branches/linux-2.6-cifs-git-devel/fs/cifs/CHANGES
===================================================================
--- branches/linux-2.6-cifs-git-devel/fs/cifs/CHANGES	2007-02-08 18:02:39 UTC (rev 101)
+++ branches/linux-2.6-cifs-git-devel/fs/cifs/CHANGES	2007-02-08 18:15:57 UTC (rev 102)
@@ -1,6 +1,8 @@
 Version 1.47
 ------------
 Fix oops in list_del during mount caused by unaligned string.
+Fix file corruption which could occur on some large file
+copies caused by writepages page i/o completion bug.
 Seek to SEEK_END forces check for update of file size for non-cached
 files.
 

Modified: branches/linux-2.6-cifs-git-devel/fs/cifs/cifspdu.h
===================================================================
--- branches/linux-2.6-cifs-git-devel/fs/cifs/cifspdu.h	2007-02-08 18:02:39 UTC (rev 101)
+++ branches/linux-2.6-cifs-git-devel/fs/cifs/cifspdu.h	2007-02-08 18:15:57 UTC (rev 102)
@@ -796,6 +796,8 @@
 	__u16  ByteCount;
 } __attribute__((packed)) OPENX_RSP; 
 
+/* For encoding of POSIX Open Request - see trans2 function 0x209 data struct */
+
 /* Legacy write request for older servers */
 typedef struct smb_com_writex_req {
         struct smb_hdr hdr;     /* wct = 12 */
@@ -2096,6 +2098,19 @@
 
 /* end of POSIX ACL definitions */
 
+typedef struct {
+	__u32 OpenFlags; /* same as NT CreateX */
+	__u32 PosixOpenFlags;
+	__u32 Mode;
+	__u16 Level; /* reply level requested (see QPathInfo levels) */
+	__u16 Pad;  /* reserved - MBZ */
+} __attribute__((packed)) OPEN_PSX_REQ; /* level 0x209 SetPathInfo data */
+
+typedef struct {
+	/* reply varies based on requested level */
+} __atribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */
+
+
 struct file_internal_info {
 	__u64  UniqueId; /* inode number */
 } __attribute__((packed));      /* level 0x3ee */

Modified: branches/linux-2.6-cifs-git-devel/fs/cifs/cifsproto.h
===================================================================
--- branches/linux-2.6-cifs-git-devel/fs/cifs/cifsproto.h	2007-02-08 18:02:39 UTC (rev 101)
+++ branches/linux-2.6-cifs-git-devel/fs/cifs/cifsproto.h	2007-02-08 18:15:57 UTC (rev 102)
@@ -57,7 +57,7 @@
 				int * /* bytes returned */);
 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-2.6-cifs-git-devel/fs/cifs/file.c
===================================================================
--- branches/linux-2.6-cifs-git-devel/fs/cifs/file.c	2007-02-08 18:02:39 UTC (rev 101)
+++ branches/linux-2.6-cifs-git-devel/fs/cifs/file.c	2007-02-08 18:15:57 UTC (rev 102)
@@ -1954,7 +1954,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;
 
@@ -1976,6 +1976,9 @@
 			return 1;
 		}
 
+		if(i_size_read(&cifsInode->vfs_inode) < end_of_file)
+			return 1;
+
 		return 0;
 	} else
 		return 1;

Modified: branches/linux-2.6-cifs-git-devel/fs/cifs/inode.c
===================================================================
--- branches/linux-2.6-cifs-git-devel/fs/cifs/inode.c	2007-02-08 18:02:39 UTC (rev 101)
+++ branches/linux-2.6-cifs-git-devel/fs/cifs/inode.c	2007-02-08 18:15:57 UTC (rev 102)
@@ -140,7 +140,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 */
 
@@ -491,8 +491,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-2.6-cifs-git-devel/fs/cifs/readdir.c
===================================================================
--- branches/linux-2.6-cifs-git-devel/fs/cifs/readdir.c	2007-02-08 18:02:39 UTC (rev 101)
+++ branches/linux-2.6-cifs-git-devel/fs/cifs/readdir.c	2007-02-08 18:15:57 UTC (rev 102)
@@ -222,7 +222,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);
@@ -351,10 +351,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