[linux-cifs-client] [PATCH] cifs: set SYNCHRONIZE bit when opening for cifs_rename_pending_delete

Jeff Layton jlayton at redhat.com
Sat Feb 28 17:59:02 GMT 2009


From: Jeff Layton <jlayton at tupile.poochiereds.net>

Discovered at Connectathon 2009...

Some servers apparently require that the filehandle passed to a trans2
rename be opened with the SYNCHRONIZE bit set. If it isn't then the
server may throw back an error.

This patch makes the cifs-capable connectathon tests pass when run
against BlueArc servers. I've also heard rumors that Win2k requires
that the file be opened with this bit set as well, but I haven't
confirmed it.

Signed-off-by: Jeff Layton <jlayton at redhat.com>
---
 fs/cifs/inode.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 050552c..a80d86d 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -872,8 +872,9 @@ cifs_rename_pending_delete(char *full_path, struct dentry *dentry, int xid)
 	FILE_BASIC_INFO *info_buf = NULL;
 
 	rc = CIFSSMBOpen(xid, tcon, full_path, FILE_OPEN,
-			 DELETE|FILE_WRITE_ATTRIBUTES, CREATE_NOT_DIR,
-			 &netfid, &oplock, NULL, cifs_sb->local_nls,
+			 DELETE|FILE_WRITE_ATTRIBUTES|SYNCHRONIZE,
+			 CREATE_NOT_DIR, &netfid, &oplock, NULL,
+			 cifs_sb->local_nls,
 			 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
 	if (rc != 0)
 		goto out;
@@ -1349,7 +1350,7 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath,
 		return rc;
 
 	/* open the file to be renamed -- we need DELETE perms */
-	rc = CIFSSMBOpen(xid, pTcon, fromPath, FILE_OPEN, DELETE,
+	rc = CIFSSMBOpen(xid, pTcon, fromPath, FILE_OPEN, DELETE|SYNCHRONIZE,
 			 CREATE_NOT_DIR, &srcfid, &oplock, NULL,
 			 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
 				CIFS_MOUNT_MAP_SPECIAL_CHR);
-- 
1.5.5.6



More information about the linux-cifs-client mailing list