aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2009-02-21 16:17:43 -0500
committerSteve French <sfrench@us.ibm.com>2009-03-11 21:36:20 -0400
commitb298f223559e0205244f553ceef8c7df3674da74 (patch)
treea65cb2f64d1b999b7b573857a8b33bbb83ff97af /fs/cifs/file.c
parentebdcc81c71937b30e09110c02a1e8a21fa770b6f (diff)
[CIFS] Send SMB flush in cifs_fsync
In contrast to the now-obsolete smbfs, cifs does not send SMB_COM_FLUSH in response to an explicit fsync(2) to guarantee that all volatile data is written to stable storage on the server side, provided the server honors the request (which, to my knowledge, is true for Windows and Samba with 'strict sync' enabled). This patch modifies the cifs_fsync implementation to restore the fsync-behavior of smbfs by triggering SMB_COM_FLUSH after sending outstanding data on the client side to the server. Signed-off-by: Horst Reiterer <horst.reiterer@gmail.com> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 12bb656fbe75..83b4741b6ad0 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1523,6 +1523,9 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1523{ 1523{
1524 int xid; 1524 int xid;
1525 int rc = 0; 1525 int rc = 0;
1526 struct cifsTconInfo *tcon;
1527 struct cifsFileInfo *smbfile =
1528 (struct cifsFileInfo *)file->private_data;
1526 struct inode *inode = file->f_path.dentry->d_inode; 1529 struct inode *inode = file->f_path.dentry->d_inode;
1527 1530
1528 xid = GetXid(); 1531 xid = GetXid();
@@ -1534,7 +1537,11 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1534 if (rc == 0) { 1537 if (rc == 0) {
1535 rc = CIFS_I(inode)->write_behind_rc; 1538 rc = CIFS_I(inode)->write_behind_rc;
1536 CIFS_I(inode)->write_behind_rc = 0; 1539 CIFS_I(inode)->write_behind_rc = 0;
1540 tcon = CIFS_SB(inode->i_sb)->tcon;
1541 if (!rc && tcon && smbfile)
1542 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
1537 } 1543 }
1544
1538 FreeXid(xid); 1545 FreeXid(xid);
1539 return rc; 1546 return rc;
1540} 1547}