diff options
| -rw-r--r-- | fs/cifs/dir.c | 48 | ||||
| -rw-r--r-- | fs/cifs/file.c | 47 |
2 files changed, 47 insertions, 48 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 600eac18cb21..3840eddbfb7a 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
| @@ -130,54 +130,6 @@ cifs_bp_rename_retry: | |||
| 130 | return full_path; | 130 | return full_path; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | struct cifsFileInfo * | ||
| 134 | cifs_new_fileinfo(__u16 fileHandle, struct file *file, | ||
| 135 | struct tcon_link *tlink, __u32 oplock) | ||
| 136 | { | ||
| 137 | struct dentry *dentry = file->f_path.dentry; | ||
| 138 | struct inode *inode = dentry->d_inode; | ||
| 139 | struct cifsInodeInfo *pCifsInode = CIFS_I(inode); | ||
| 140 | struct cifsFileInfo *pCifsFile; | ||
| 141 | |||
| 142 | pCifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); | ||
| 143 | if (pCifsFile == NULL) | ||
| 144 | return pCifsFile; | ||
| 145 | |||
| 146 | pCifsFile->netfid = fileHandle; | ||
| 147 | pCifsFile->pid = current->tgid; | ||
| 148 | pCifsFile->uid = current_fsuid(); | ||
| 149 | pCifsFile->dentry = dget(dentry); | ||
| 150 | pCifsFile->f_flags = file->f_flags; | ||
| 151 | pCifsFile->invalidHandle = false; | ||
| 152 | pCifsFile->closePend = false; | ||
| 153 | pCifsFile->tlink = cifs_get_tlink(tlink); | ||
| 154 | mutex_init(&pCifsFile->fh_mutex); | ||
| 155 | mutex_init(&pCifsFile->lock_mutex); | ||
| 156 | INIT_LIST_HEAD(&pCifsFile->llist); | ||
| 157 | atomic_set(&pCifsFile->count, 1); | ||
| 158 | INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); | ||
| 159 | |||
| 160 | write_lock(&GlobalSMBSeslock); | ||
| 161 | list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); | ||
| 162 | /* if readable file instance put first in list*/ | ||
| 163 | if (file->f_mode & FMODE_READ) | ||
| 164 | list_add(&pCifsFile->flist, &pCifsInode->openFileList); | ||
| 165 | else | ||
| 166 | list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList); | ||
| 167 | write_unlock(&GlobalSMBSeslock); | ||
| 168 | |||
| 169 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | ||
| 170 | pCifsInode->clientCanCacheAll = true; | ||
| 171 | pCifsInode->clientCanCacheRead = true; | ||
| 172 | cFYI(1, "Exclusive Oplock inode %p", inode); | ||
| 173 | } else if ((oplock & 0xF) == OPLOCK_READ) | ||
| 174 | pCifsInode->clientCanCacheRead = true; | ||
| 175 | |||
| 176 | file->private_data = pCifsFile; | ||
| 177 | |||
| 178 | return pCifsFile; | ||
| 179 | } | ||
| 180 | |||
| 181 | static void setup_cifs_dentry(struct cifsTconInfo *tcon, | 133 | static void setup_cifs_dentry(struct cifsTconInfo *tcon, |
| 182 | struct dentry *direntry, | 134 | struct dentry *direntry, |
| 183 | struct inode *newinode) | 135 | struct inode *newinode) |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 7935816fa111..293e9b767621 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
| @@ -219,6 +219,53 @@ posix_open_ret: | |||
| 219 | return rc; | 219 | return rc; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | struct cifsFileInfo * | ||
| 223 | cifs_new_fileinfo(__u16 fileHandle, struct file *file, | ||
| 224 | struct tcon_link *tlink, __u32 oplock) | ||
| 225 | { | ||
| 226 | struct dentry *dentry = file->f_path.dentry; | ||
| 227 | struct inode *inode = dentry->d_inode; | ||
| 228 | struct cifsInodeInfo *pCifsInode = CIFS_I(inode); | ||
| 229 | struct cifsFileInfo *pCifsFile; | ||
| 230 | |||
| 231 | pCifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); | ||
| 232 | if (pCifsFile == NULL) | ||
| 233 | return pCifsFile; | ||
| 234 | |||
| 235 | pCifsFile->netfid = fileHandle; | ||
| 236 | pCifsFile->pid = current->tgid; | ||
| 237 | pCifsFile->uid = current_fsuid(); | ||
| 238 | pCifsFile->dentry = dget(dentry); | ||
| 239 | pCifsFile->f_flags = file->f_flags; | ||
| 240 | pCifsFile->invalidHandle = false; | ||
| 241 | pCifsFile->closePend = false; | ||
| 242 | pCifsFile->tlink = cifs_get_tlink(tlink); | ||
| 243 | mutex_init(&pCifsFile->fh_mutex); | ||
| 244 | mutex_init(&pCifsFile->lock_mutex); | ||
| 245 | INIT_LIST_HEAD(&pCifsFile->llist); | ||
| 246 | atomic_set(&pCifsFile->count, 1); | ||
| 247 | INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); | ||
| 248 | |||
| 249 | write_lock(&GlobalSMBSeslock); | ||
| 250 | list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); | ||
| 251 | /* if readable file instance put first in list*/ | ||
| 252 | if (file->f_mode & FMODE_READ) | ||
| 253 | list_add(&pCifsFile->flist, &pCifsInode->openFileList); | ||
| 254 | else | ||
| 255 | list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList); | ||
| 256 | write_unlock(&GlobalSMBSeslock); | ||
| 257 | |||
| 258 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | ||
| 259 | pCifsInode->clientCanCacheAll = true; | ||
| 260 | pCifsInode->clientCanCacheRead = true; | ||
| 261 | cFYI(1, "Exclusive Oplock inode %p", inode); | ||
| 262 | } else if ((oplock & 0xF) == OPLOCK_READ) | ||
| 263 | pCifsInode->clientCanCacheRead = true; | ||
| 264 | |||
| 265 | file->private_data = pCifsFile; | ||
| 266 | return pCifsFile; | ||
| 267 | } | ||
| 268 | |||
| 222 | int cifs_open(struct inode *inode, struct file *file) | 269 | int cifs_open(struct inode *inode, struct file *file) |
| 223 | { | 270 | { |
| 224 | int rc = -EACCES; | 271 | int rc = -EACCES; |
