aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 9d0dd952ad79..ad14d3c66b25 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1524,12 +1524,12 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
1524 * read won't conflict with non-overlapted locks due to 1524 * read won't conflict with non-overlapted locks due to
1525 * pagereading. 1525 * pagereading.
1526 */ 1526 */
1527 if (!CIFS_I(inode)->clientCanCacheAll && 1527 if (!CIFS_CACHE_WRITE(CIFS_I(inode)) &&
1528 CIFS_I(inode)->clientCanCacheRead) { 1528 CIFS_CACHE_READ(CIFS_I(inode))) {
1529 cifs_invalidate_mapping(inode); 1529 cifs_invalidate_mapping(inode);
1530 cifs_dbg(FYI, "Set no oplock for inode=%p due to mand locks\n", 1530 cifs_dbg(FYI, "Set no oplock for inode=%p due to mand locks\n",
1531 inode); 1531 inode);
1532 CIFS_I(inode)->clientCanCacheRead = false; 1532 CIFS_I(inode)->oplock = 0;
1533 } 1533 }
1534 1534
1535 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, 1535 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length,
@@ -2213,7 +2213,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
2213 cifs_dbg(FYI, "Sync file - name: %s datasync: 0x%x\n", 2213 cifs_dbg(FYI, "Sync file - name: %s datasync: 0x%x\n",
2214 file->f_path.dentry->d_name.name, datasync); 2214 file->f_path.dentry->d_name.name, datasync);
2215 2215
2216 if (!CIFS_I(inode)->clientCanCacheRead) { 2216 if (!CIFS_CACHE_READ(CIFS_I(inode))) {
2217 rc = cifs_invalidate_mapping(inode); 2217 rc = cifs_invalidate_mapping(inode);
2218 if (rc) { 2218 if (rc) {
2219 cifs_dbg(FYI, "rc: %d during invalidate phase\n", rc); 2219 cifs_dbg(FYI, "rc: %d during invalidate phase\n", rc);
@@ -2577,7 +2577,7 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
2577 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 2577 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
2578 ssize_t written; 2578 ssize_t written;
2579 2579
2580 if (cinode->clientCanCacheAll) { 2580 if (CIFS_CACHE_WRITE(cinode)) {
2581 if (cap_unix(tcon->ses) && 2581 if (cap_unix(tcon->ses) &&
2582 (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) 2582 (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability))
2583 && ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) 2583 && ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0))
@@ -2591,7 +2591,7 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
2591 * these pages but not on the region from pos to ppos+len-1. 2591 * these pages but not on the region from pos to ppos+len-1.
2592 */ 2592 */
2593 written = cifs_user_writev(iocb, iov, nr_segs, pos); 2593 written = cifs_user_writev(iocb, iov, nr_segs, pos);
2594 if (written > 0 && cinode->clientCanCacheRead) { 2594 if (written > 0 && CIFS_CACHE_READ(cinode)) {
2595 /* 2595 /*
2596 * Windows 7 server can delay breaking level2 oplock if a write 2596 * Windows 7 server can delay breaking level2 oplock if a write
2597 * request comes - break it on the client to prevent reading 2597 * request comes - break it on the client to prevent reading
@@ -2600,7 +2600,7 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
2600 cifs_invalidate_mapping(inode); 2600 cifs_invalidate_mapping(inode);
2601 cifs_dbg(FYI, "Set no oplock for inode=%p after a write operation\n", 2601 cifs_dbg(FYI, "Set no oplock for inode=%p after a write operation\n",
2602 inode); 2602 inode);
2603 cinode->clientCanCacheRead = false; 2603 cinode->oplock = 0;
2604 } 2604 }
2605 return written; 2605 return written;
2606} 2606}
@@ -2957,7 +2957,7 @@ cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
2957 * on pages affected by this read but not on the region from pos to 2957 * on pages affected by this read but not on the region from pos to
2958 * pos+len-1. 2958 * pos+len-1.
2959 */ 2959 */
2960 if (!cinode->clientCanCacheRead) 2960 if (!CIFS_CACHE_READ(cinode))
2961 return cifs_user_readv(iocb, iov, nr_segs, pos); 2961 return cifs_user_readv(iocb, iov, nr_segs, pos);
2962 2962
2963 if (cap_unix(tcon->ses) && 2963 if (cap_unix(tcon->ses) &&
@@ -3093,7 +3093,7 @@ int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
3093 3093
3094 xid = get_xid(); 3094 xid = get_xid();
3095 3095
3096 if (!CIFS_I(inode)->clientCanCacheRead) { 3096 if (!CIFS_CACHE_READ(CIFS_I(inode))) {
3097 rc = cifs_invalidate_mapping(inode); 3097 rc = cifs_invalidate_mapping(inode);
3098 if (rc) 3098 if (rc)
3099 return rc; 3099 return rc;
@@ -3526,7 +3526,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
3526 * is, when the page lies beyond the EOF, or straddles the EOF 3526 * is, when the page lies beyond the EOF, or straddles the EOF
3527 * and the write will cover all of the existing data. 3527 * and the write will cover all of the existing data.
3528 */ 3528 */
3529 if (CIFS_I(mapping->host)->clientCanCacheRead) { 3529 if (CIFS_CACHE_READ(CIFS_I(mapping->host))) {
3530 i_size = i_size_read(mapping->host); 3530 i_size = i_size_read(mapping->host);
3531 if (page_start >= i_size || 3531 if (page_start >= i_size ||
3532 (offset == 0 && (pos + len) >= i_size)) { 3532 (offset == 0 && (pos + len) >= i_size)) {
@@ -3609,20 +3609,20 @@ void cifs_oplock_break(struct work_struct *work)
3609 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 3609 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
3610 int rc = 0; 3610 int rc = 0;
3611 3611
3612 if (!cinode->clientCanCacheAll && cinode->clientCanCacheRead && 3612 if (!CIFS_CACHE_WRITE(cinode) && CIFS_CACHE_READ(cinode) &&
3613 cifs_has_mand_locks(cinode)) { 3613 cifs_has_mand_locks(cinode)) {
3614 cifs_dbg(FYI, "Reset oplock to None for inode=%p due to mand locks\n", 3614 cifs_dbg(FYI, "Reset oplock to None for inode=%p due to mand locks\n",
3615 inode); 3615 inode);
3616 cinode->clientCanCacheRead = false; 3616 cinode->oplock = 0;
3617 } 3617 }
3618 3618
3619 if (inode && S_ISREG(inode->i_mode)) { 3619 if (inode && S_ISREG(inode->i_mode)) {
3620 if (cinode->clientCanCacheRead) 3620 if (CIFS_CACHE_READ(cinode))
3621 break_lease(inode, O_RDONLY); 3621 break_lease(inode, O_RDONLY);
3622 else 3622 else
3623 break_lease(inode, O_WRONLY); 3623 break_lease(inode, O_WRONLY);
3624 rc = filemap_fdatawrite(inode->i_mapping); 3624 rc = filemap_fdatawrite(inode->i_mapping);
3625 if (cinode->clientCanCacheRead == 0) { 3625 if (!CIFS_CACHE_READ(cinode)) {
3626 rc = filemap_fdatawait(inode->i_mapping); 3626 rc = filemap_fdatawait(inode->i_mapping);
3627 mapping_set_error(inode->i_mapping, rc); 3627 mapping_set_error(inode->i_mapping, rc);
3628 cifs_invalidate_mapping(inode); 3628 cifs_invalidate_mapping(inode);