[CIFS] Fix sparse warnings

Signed-off-by: Shirish Pargaonkar <shirishp@us.ibm.com>
CC: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>

+18 -12
+17 -9
fs/cifs/dir.c
··· 149 pCifsFile->pid = current->tgid; 150 pCifsFile->pInode = newinode; 151 pCifsFile->invalidHandle = false; 152 - pCifsFile->closePend = false; 153 mutex_init(&pCifsFile->fh_mutex); 154 mutex_init(&pCifsFile->lock_mutex); 155 INIT_LIST_HEAD(&pCifsFile->llist); ··· 162 pCifsInode = CIFS_I(newinode); 163 if (pCifsInode) { 164 /* if readable file instance put first in list*/ 165 - if (write_only) { 166 list_add_tail(&pCifsFile->flist, 167 &pCifsInode->openFileList); 168 - } else { 169 - list_add(&pCifsFile->flist, 170 - &pCifsInode->openFileList); 171 - } 172 if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { 173 pCifsInode->clientCanCacheAll = true; 174 pCifsInode->clientCanCacheRead = true; 175 - cFYI(1, ("Exclusive Oplock inode %p", 176 - newinode)); 177 } else if ((oplock & 0xF) == OPLOCK_READ) 178 - pCifsInode->clientCanCacheRead = true; 179 } 180 write_unlock(&GlobalSMBSeslock); 181 } ··· 666 parent_dir_inode->i_sb, mode, 667 nd->intent.open.flags, &oplock, 668 &fileHandle, xid); 669 if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) 670 posix_open = true; 671 }
··· 149 pCifsFile->pid = current->tgid; 150 pCifsFile->pInode = newinode; 151 pCifsFile->invalidHandle = false; 152 + pCifsFile->closePend = false; 153 mutex_init(&pCifsFile->fh_mutex); 154 mutex_init(&pCifsFile->lock_mutex); 155 INIT_LIST_HEAD(&pCifsFile->llist); ··· 162 pCifsInode = CIFS_I(newinode); 163 if (pCifsInode) { 164 /* if readable file instance put first in list*/ 165 + if (write_only) 166 list_add_tail(&pCifsFile->flist, 167 &pCifsInode->openFileList); 168 + else 169 + list_add(&pCifsFile->flist, &pCifsInode->openFileList); 170 + 171 if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { 172 pCifsInode->clientCanCacheAll = true; 173 pCifsInode->clientCanCacheRead = true; 174 + cFYI(1, ("Exclusive Oplock inode %p", newinode)); 175 } else if ((oplock & 0xF) == OPLOCK_READ) 176 + pCifsInode->clientCanCacheRead = true; 177 } 178 write_unlock(&GlobalSMBSeslock); 179 } ··· 668 parent_dir_inode->i_sb, mode, 669 nd->intent.open.flags, &oplock, 670 &fileHandle, xid); 671 + /* 672 + * This code works around a bug in 673 + * samba posix open in samba versions 3.3.1 674 + * and earlier where create works 675 + * but open fails with invalid parameter. 676 + * If either of these error codes are 677 + * returned, follow the normal lookup. 678 + * Otherwise, the error during posix open 679 + * is handled. 680 + */ 681 if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) 682 posix_open = true; 683 }
+1 -3
fs/cifs/file.c
··· 307 rc = 0; 308 FreeXid(xid); 309 return rc; 310 - } else { 311 - if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) 312 cERROR(1, ("could not find file instance for " 313 "new file %p", file)); 314 - } 315 316 full_path = build_path_from_dentry(file->f_path.dentry); 317 if (full_path == NULL) {
··· 307 rc = 0; 308 FreeXid(xid); 309 return rc; 310 + } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) 311 cERROR(1, ("could not find file instance for " 312 "new file %p", file)); 313 314 full_path = build_path_from_dentry(file->f_path.dentry); 315 if (full_path == NULL) {