aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorPavel Shilovsky <piastryyy@gmail.com>2010-12-12 05:11:13 -0500
committerSteve French <sfrench@us.ibm.com>2011-01-20 16:42:21 -0500
commit8be7e6ba142423e6ad98fed293c96f196f685229 (patch)
tree25bd7ce4aed4740082f0a472a8eed35127d9d61e /fs/cifs/file.c
parent4f8ba8a0c095933dd54a2c281750c8a85b329b26 (diff)
CIFS: Implement cifs_strict_fsync
Invalidate inode mapping if we don't have at least Level II oplock in cifs_strict_fsync. Also remove filemap_write_and_wait call from cifs_fsync because it is previously called from vfs_fsync_range. Add file operations' structures for strict cache mode. Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 1b26c2717599..5790fab7349b 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1528,27 +1528,47 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
1528 return rc; 1528 return rc;
1529} 1529}
1530 1530
1531int cifs_fsync(struct file *file, int datasync) 1531int cifs_strict_fsync(struct file *file, int datasync)
1532{ 1532{
1533 int xid; 1533 int xid;
1534 int rc = 0; 1534 int rc = 0;
1535 struct cifsTconInfo *tcon; 1535 struct cifsTconInfo *tcon;
1536 struct cifsFileInfo *smbfile = file->private_data; 1536 struct cifsFileInfo *smbfile = file->private_data;
1537 struct inode *inode = file->f_path.dentry->d_inode; 1537 struct inode *inode = file->f_path.dentry->d_inode;
1538 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1538 1539
1539 xid = GetXid(); 1540 xid = GetXid();
1540 1541
1541 cFYI(1, "Sync file - name: %s datasync: 0x%x", 1542 cFYI(1, "Sync file - name: %s datasync: 0x%x",
1542 file->f_path.dentry->d_name.name, datasync); 1543 file->f_path.dentry->d_name.name, datasync);
1543 1544
1544 rc = filemap_write_and_wait(inode->i_mapping); 1545 if (!CIFS_I(inode)->clientCanCacheRead)
1545 if (rc == 0) { 1546 cifs_invalidate_mapping(inode);
1546 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1547 1547
1548 tcon = tlink_tcon(smbfile->tlink); 1548 tcon = tlink_tcon(smbfile->tlink);
1549 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) 1549 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
1550 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); 1550 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
1551 } 1551
1552 FreeXid(xid);
1553 return rc;
1554}
1555
1556int cifs_fsync(struct file *file, int datasync)
1557{
1558 int xid;
1559 int rc = 0;
1560 struct cifsTconInfo *tcon;
1561 struct cifsFileInfo *smbfile = file->private_data;
1562 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1563
1564 xid = GetXid();
1565
1566 cFYI(1, "Sync file - name: %s datasync: 0x%x",
1567 file->f_path.dentry->d_name.name, datasync);
1568
1569 tcon = tlink_tcon(smbfile->tlink);
1570 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
1571 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
1552 1572
1553 FreeXid(xid); 1573 FreeXid(xid);
1554 return rc; 1574 return rc;