diff options
-rw-r--r-- | fs/cifs/file.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 9cbf0f097a39..5b9d1f25aaec 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -163,11 +163,11 @@ psx_client_can_cache: | |||
163 | } | 163 | } |
164 | 164 | ||
165 | /* all arguments to this function must be checked for validity in caller */ | 165 | /* all arguments to this function must be checked for validity in caller */ |
166 | static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, | 166 | static inline int cifs_open_inode_helper(struct inode *inode, |
167 | struct cifsInodeInfo *pCifsInode, struct cifsFileInfo *pCifsFile, | ||
168 | struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf, | 167 | struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf, |
169 | char *full_path, int xid) | 168 | char *full_path, int xid) |
170 | { | 169 | { |
170 | struct cifsInodeInfo *pCifsInode = CIFS_I(inode); | ||
171 | struct timespec temp; | 171 | struct timespec temp; |
172 | int rc; | 172 | int rc; |
173 | 173 | ||
@@ -181,36 +181,35 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, | |||
181 | /* if not oplocked, invalidate inode pages if mtime or file | 181 | /* if not oplocked, invalidate inode pages if mtime or file |
182 | size changed */ | 182 | size changed */ |
183 | temp = cifs_NTtimeToUnix(buf->LastWriteTime); | 183 | temp = cifs_NTtimeToUnix(buf->LastWriteTime); |
184 | if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) && | 184 | if (timespec_equal(&inode->i_mtime, &temp) && |
185 | (file->f_path.dentry->d_inode->i_size == | 185 | (inode->i_size == |
186 | (loff_t)le64_to_cpu(buf->EndOfFile))) { | 186 | (loff_t)le64_to_cpu(buf->EndOfFile))) { |
187 | cFYI(1, "inode unchanged on server"); | 187 | cFYI(1, "inode unchanged on server"); |
188 | } else { | 188 | } else { |
189 | if (file->f_path.dentry->d_inode->i_mapping) { | 189 | if (inode->i_mapping) { |
190 | /* BB no need to lock inode until after invalidate | 190 | /* BB no need to lock inode until after invalidate |
191 | since namei code should already have it locked? */ | 191 | since namei code should already have it locked? */ |
192 | rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping); | 192 | rc = filemap_write_and_wait(inode->i_mapping); |
193 | if (rc != 0) | 193 | if (rc != 0) |
194 | CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; | 194 | pCifsInode->write_behind_rc = rc; |
195 | } | 195 | } |
196 | cFYI(1, "invalidating remote inode since open detected it " | 196 | cFYI(1, "invalidating remote inode since open detected it " |
197 | "changed"); | 197 | "changed"); |
198 | invalidate_remote_inode(file->f_path.dentry->d_inode); | 198 | invalidate_remote_inode(inode); |
199 | } | 199 | } |
200 | 200 | ||
201 | client_can_cache: | 201 | client_can_cache: |
202 | if (pTcon->unix_ext) | 202 | if (pTcon->unix_ext) |
203 | rc = cifs_get_inode_info_unix(&file->f_path.dentry->d_inode, | 203 | rc = cifs_get_inode_info_unix(&inode, full_path, inode->i_sb, |
204 | full_path, inode->i_sb, xid); | 204 | xid); |
205 | else | 205 | else |
206 | rc = cifs_get_inode_info(&file->f_path.dentry->d_inode, | 206 | rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb, |
207 | full_path, buf, inode->i_sb, xid, NULL); | 207 | xid, NULL); |
208 | 208 | ||
209 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 209 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
210 | pCifsInode->clientCanCacheAll = true; | 210 | pCifsInode->clientCanCacheAll = true; |
211 | pCifsInode->clientCanCacheRead = true; | 211 | pCifsInode->clientCanCacheRead = true; |
212 | cFYI(1, "Exclusive Oplock granted on inode %p", | 212 | cFYI(1, "Exclusive Oplock granted on inode %p", inode); |
213 | file->f_path.dentry->d_inode); | ||
214 | } else if ((*oplock & 0xF) == OPLOCK_READ) | 213 | } else if ((*oplock & 0xF) == OPLOCK_READ) |
215 | pCifsInode->clientCanCacheRead = true; | 214 | pCifsInode->clientCanCacheRead = true; |
216 | 215 | ||
@@ -367,8 +366,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
367 | goto out; | 366 | goto out; |
368 | } | 367 | } |
369 | 368 | ||
370 | rc = cifs_open_inode_helper(inode, file, pCifsInode, pCifsFile, tcon, | 369 | rc = cifs_open_inode_helper(inode, tcon, &oplock, buf, full_path, xid); |
371 | &oplock, buf, full_path, xid); | ||
372 | 370 | ||
373 | if (oplock & CIFS_CREATE_ACTION) { | 371 | if (oplock & CIFS_CREATE_ACTION) { |
374 | /* time to set mode which we can not set earlier due to | 372 | /* time to set mode which we can not set earlier due to |