From 3acdd675f7e7cf27d980f4c2a74bfd12ec3f6d23 Mon Sep 17 00:00:00 2001 From: Steve French Date: Sun, 12 Apr 2009 18:18:40 +0000 Subject: [PATCH] --- yaml --- r: 143697 b: refs/heads/master c: bc8cd4390c9129fbd286b10fa99972dfb68cd069 h: refs/heads/master i: 143695: 6c3d97a50e862d4e301e025d00df2f5976f871b6 v: v3 --- [refs] | 2 +- trunk/fs/cifs/dir.c | 26 +++++++++++++++++--------- trunk/fs/cifs/file.c | 4 +--- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 54d0d54a2eb3..894f6b4a71d2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a6ce4932fbdbcd8f8e8c6df76812014351c32892 +refs/heads/master: bc8cd4390c9129fbd286b10fa99972dfb68cd069 diff --git a/trunk/fs/cifs/dir.c b/trunk/fs/cifs/dir.c index d9006b04324e..e937da7522ef 100644 --- a/trunk/fs/cifs/dir.c +++ b/trunk/fs/cifs/dir.c @@ -149,7 +149,7 @@ cifs_fill_fileinfo(struct inode *newinode, __u16 fileHandle, pCifsFile->pid = current->tgid; pCifsFile->pInode = newinode; pCifsFile->invalidHandle = false; - pCifsFile->closePend = false; + pCifsFile->closePend = false; mutex_init(&pCifsFile->fh_mutex); mutex_init(&pCifsFile->lock_mutex); INIT_LIST_HEAD(&pCifsFile->llist); @@ -162,20 +162,18 @@ cifs_fill_fileinfo(struct inode *newinode, __u16 fileHandle, pCifsInode = CIFS_I(newinode); if (pCifsInode) { /* if readable file instance put first in list*/ - if (write_only) { + if (write_only) list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList); - } else { - list_add(&pCifsFile->flist, - &pCifsInode->openFileList); - } + else + list_add(&pCifsFile->flist, &pCifsInode->openFileList); + if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { pCifsInode->clientCanCacheAll = true; pCifsInode->clientCanCacheRead = true; - cFYI(1, ("Exclusive Oplock inode %p", - newinode)); + cFYI(1, ("Exclusive Oplock inode %p", newinode)); } else if ((oplock & 0xF) == OPLOCK_READ) - pCifsInode->clientCanCacheRead = true; + pCifsInode->clientCanCacheRead = true; } write_unlock(&GlobalSMBSeslock); } @@ -668,6 +666,16 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, parent_dir_inode->i_sb, mode, nd->intent.open.flags, &oplock, &fileHandle, xid); + /* + * This code works around a bug in + * samba posix open in samba versions 3.3.1 + * and earlier where create works + * but open fails with invalid parameter. + * If either of these error codes are + * returned, follow the normal lookup. + * Otherwise, the error during posix open + * is handled. + */ if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) posix_open = true; } diff --git a/trunk/fs/cifs/file.c b/trunk/fs/cifs/file.c index 48c9ae09f3d6..50ca088d8860 100644 --- a/trunk/fs/cifs/file.c +++ b/trunk/fs/cifs/file.c @@ -307,11 +307,9 @@ int cifs_open(struct inode *inode, struct file *file) rc = 0; FreeXid(xid); return rc; - } else { - if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) + } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) cERROR(1, ("could not find file instance for " "new file %p", file)); - } full_path = build_path_from_dentry(file->f_path.dentry); if (full_path == NULL) {