diff options
author | Steve French <sfrench@us.ibm.com> | 2009-05-21 18:21:53 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2009-05-21 18:38:08 -0400 |
commit | 703a3b8e5c01cf6fb33c6d8dc99905f889a4e992 (patch) | |
tree | 56b6f7bd0379efc28fd488b15fe121a03d092f3d /fs/cifs/dir.c | |
parent | 5805977e63a36ad56594a623f3bd2bebcb7db233 (diff) |
[CIFS] fix posix open regression
Posix open code was not properly adding the file to the
list of open files. Fix allocating cifsFileInfo
more than once, and adding twice to flist and tlist.
Also fix mode setting to be done in one place in these
paths.
Signed-off-by: Steve French <sfrench@us.ibm.com>
Reviewed-by: Shirish Pargaonkar <shirishp@us.ibm.com>
Tested-by: Jeff Layton <jlayton@redhat.com>
Tested-by: Luca Tettamanti <kronos.it@gmail.com>
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r-- | fs/cifs/dir.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 11431ed72a7f..f49d684edd96 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -225,6 +225,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, | |||
225 | if (!(oflags & FMODE_READ)) | 225 | if (!(oflags & FMODE_READ)) |
226 | write_only = true; | 226 | write_only = true; |
227 | 227 | ||
228 | mode &= ~current_umask(); | ||
228 | rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, | 229 | rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, |
229 | pnetfid, presp_data, &oplock, full_path, | 230 | pnetfid, presp_data, &oplock, full_path, |
230 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | 231 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & |
@@ -310,7 +311,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
310 | return -ENOMEM; | 311 | return -ENOMEM; |
311 | } | 312 | } |
312 | 313 | ||
313 | mode &= ~current_umask(); | ||
314 | if (oplockEnabled) | 314 | if (oplockEnabled) |
315 | oplock = REQ_OPLOCK; | 315 | oplock = REQ_OPLOCK; |
316 | 316 | ||
@@ -336,7 +336,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
336 | else /* success, no need to query */ | 336 | else /* success, no need to query */ |
337 | goto cifs_create_set_dentry; | 337 | goto cifs_create_set_dentry; |
338 | } else if ((rc != -EIO) && (rc != -EREMOTE) && | 338 | } else if ((rc != -EIO) && (rc != -EREMOTE) && |
339 | (rc != -EOPNOTSUPP)) /* path not found or net err */ | 339 | (rc != -EOPNOTSUPP) && (rc != -EINVAL)) |
340 | goto cifs_create_out; | 340 | goto cifs_create_out; |
341 | /* else fallthrough to retry, using older open call, this is | 341 | /* else fallthrough to retry, using older open call, this is |
342 | case where server does not support this SMB level, and | 342 | case where server does not support this SMB level, and |
@@ -609,7 +609,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
609 | int xid; | 609 | int xid; |
610 | int rc = 0; /* to get around spurious gcc warning, set to zero here */ | 610 | int rc = 0; /* to get around spurious gcc warning, set to zero here */ |
611 | int oplock = 0; | 611 | int oplock = 0; |
612 | int mode; | ||
613 | __u16 fileHandle = 0; | 612 | __u16 fileHandle = 0; |
614 | bool posix_open = false; | 613 | bool posix_open = false; |
615 | struct cifs_sb_info *cifs_sb; | 614 | struct cifs_sb_info *cifs_sb; |
@@ -660,13 +659,12 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
660 | 659 | ||
661 | if (pTcon->unix_ext) { | 660 | if (pTcon->unix_ext) { |
662 | if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && | 661 | if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && |
663 | (nd->flags & LOOKUP_OPEN)) { | 662 | (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open) { |
664 | if (!((nd->intent.open.flags & O_CREAT) && | 663 | if (!((nd->intent.open.flags & O_CREAT) && |
665 | (nd->intent.open.flags & O_EXCL))) { | 664 | (nd->intent.open.flags & O_EXCL))) { |
666 | mode = nd->intent.open.create_mode & | ||
667 | ~current_umask(); | ||
668 | rc = cifs_posix_open(full_path, &newInode, | 665 | rc = cifs_posix_open(full_path, &newInode, |
669 | parent_dir_inode->i_sb, mode, | 666 | parent_dir_inode->i_sb, |
667 | nd->intent.open.create_mode, | ||
670 | nd->intent.open.flags, &oplock, | 668 | nd->intent.open.flags, &oplock, |
671 | &fileHandle, xid); | 669 | &fileHandle, xid); |
672 | /* | 670 | /* |
@@ -681,6 +679,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
681 | */ | 679 | */ |
682 | if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) | 680 | if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) |
683 | posix_open = true; | 681 | posix_open = true; |
682 | else | ||
683 | pTcon->broken_posix_open = true; | ||
684 | } | 684 | } |
685 | } | 685 | } |
686 | if (!posix_open) | 686 | if (!posix_open) |