aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/cifsfs.c3
-rw-r--r--fs/cifs/cifsproto.h2
-rw-r--r--fs/cifs/file.c8
-rw-r--r--fs/cifs/misc.c16
4 files changed, 15 insertions, 14 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 38526a6c4acf..9c3789762ab7 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -321,8 +321,7 @@ cifs_alloc_inode(struct super_block *sb)
321 /* Until the file is open and we have gotten oplock 321 /* Until the file is open and we have gotten oplock
322 info back from the server, can not assume caching of 322 info back from the server, can not assume caching of
323 file data or metadata */ 323 file data or metadata */
324 cifs_inode->clientCanCacheRead = false; 324 cifs_set_oplock_level(cifs_inode, 0);
325 cifs_inode->clientCanCacheAll = false;
326 cifs_inode->delete_pending = false; 325 cifs_inode->delete_pending = false;
327 cifs_inode->invalid_mapping = false; 326 cifs_inode->invalid_mapping = false;
328 cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ 327 cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 7f050f4fc3d9..7ed69b6b5fe6 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -104,7 +104,7 @@ extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601);
104extern u64 cifs_UnixTimeToNT(struct timespec); 104extern u64 cifs_UnixTimeToNT(struct timespec);
105extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, 105extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
106 int offset); 106 int offset);
107extern void cifs_set_oplock_level(struct inode *inode, __u32 oplock); 107extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock);
108 108
109extern struct cifsFileInfo *cifs_new_fileinfo(__u16 fileHandle, 109extern struct cifsFileInfo *cifs_new_fileinfo(__u16 fileHandle,
110 struct file *file, struct tcon_link *tlink, 110 struct file *file, struct tcon_link *tlink,
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 777e7f42b5b1..06c3e83fa387 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -146,7 +146,7 @@ client_can_cache:
146 rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb, 146 rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
147 xid, NULL); 147 xid, NULL);
148 148
149 cifs_set_oplock_level(inode, oplock); 149 cifs_set_oplock_level(pCifsInode, oplock);
150 150
151 return rc; 151 return rc;
152} 152}
@@ -248,7 +248,7 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file,
248 list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList); 248 list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList);
249 spin_unlock(&cifs_file_list_lock); 249 spin_unlock(&cifs_file_list_lock);
250 250
251 cifs_set_oplock_level(inode, oplock); 251 cifs_set_oplock_level(pCifsInode, oplock);
252 252
253 file->private_data = pCifsFile; 253 file->private_data = pCifsFile;
254 return pCifsFile; 254 return pCifsFile;
@@ -279,7 +279,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
279 if (list_empty(&cifsi->openFileList)) { 279 if (list_empty(&cifsi->openFileList)) {
280 cFYI(1, "closing last open instance for inode %p", 280 cFYI(1, "closing last open instance for inode %p",
281 cifs_file->dentry->d_inode); 281 cifs_file->dentry->d_inode);
282 cifs_set_oplock_level(inode, 0); 282 cifs_set_oplock_level(cifsi, 0);
283 } 283 }
284 spin_unlock(&cifs_file_list_lock); 284 spin_unlock(&cifs_file_list_lock);
285 285
@@ -611,7 +611,7 @@ reopen_success:
611 we can not go to the server to get the new inod 611 we can not go to the server to get the new inod
612 info */ 612 info */
613 613
614 cifs_set_oplock_level(inode, oplock); 614 cifs_set_oplock_level(pCifsInode, oplock);
615 615
616 cifs_relock_file(pCifsFile); 616 cifs_relock_file(pCifsFile);
617 617
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index d3b9ddebc17e..43f10281bc19 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -570,7 +570,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
570 cFYI(1, "file id match, oplock break"); 570 cFYI(1, "file id match, oplock break");
571 pCifsInode = CIFS_I(netfile->dentry->d_inode); 571 pCifsInode = CIFS_I(netfile->dentry->d_inode);
572 572
573 cifs_set_oplock_level(netfile->dentry->d_inode, 573 cifs_set_oplock_level(pCifsInode,
574 pSMB->OplockLevel); 574 pSMB->OplockLevel);
575 /* 575 /*
576 * cifs_oplock_break_put() can't be called 576 * cifs_oplock_break_put() can't be called
@@ -722,18 +722,20 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
722 } 722 }
723} 723}
724 724
725void cifs_set_oplock_level(struct inode *inode, __u32 oplock) 725void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock)
726{ 726{
727 struct cifsInodeInfo *cinode = CIFS_I(inode); 727 oplock &= 0xF;
728 728
729 if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { 729 if (oplock == OPLOCK_EXCLUSIVE) {
730 cinode->clientCanCacheAll = true; 730 cinode->clientCanCacheAll = true;
731 cinode->clientCanCacheRead = true; 731 cinode->clientCanCacheRead = true;
732 cFYI(1, "Exclusive Oplock granted on inode %p", inode); 732 cFYI(1, "Exclusive Oplock granted on inode %p",
733 } else if ((oplock & 0xF) == OPLOCK_READ) { 733 &cinode->vfs_inode);
734 } else if (oplock == OPLOCK_READ) {
734 cinode->clientCanCacheAll = false; 735 cinode->clientCanCacheAll = false;
735 cinode->clientCanCacheRead = true; 736 cinode->clientCanCacheRead = true;
736 cFYI(1, "Level II Oplock granted on inode %p", inode); 737 cFYI(1, "Level II Oplock granted on inode %p",
738 &cinode->vfs_inode);
737 } else { 739 } else {
738 cinode->clientCanCacheAll = false; 740 cinode->clientCanCacheAll = false;
739 cinode->clientCanCacheRead = false; 741 cinode->clientCanCacheRead = false;