aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsglob.h2
-rw-r--r--fs/cifs/file.c20
-rw-r--r--fs/cifs/smb1ops.c8
3 files changed, 26 insertions, 4 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 500ecb921b85..abb831019039 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -274,6 +274,8 @@ struct smb_version_operations {
274 void (*set_fid)(struct cifsFileInfo *, struct cifs_fid *, __u32); 274 void (*set_fid)(struct cifsFileInfo *, struct cifs_fid *, __u32);
275 /* close a file */ 275 /* close a file */
276 int (*close)(const unsigned int, struct cifs_tcon *, struct cifs_fid *); 276 int (*close)(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
277 /* send a flush request to the server */
278 int (*flush)(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
277}; 279};
278 280
279struct smb_version_values { 281struct smb_version_values {
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 628ee17007f8..aa1dccf0df9e 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2062,6 +2062,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
2062 unsigned int xid; 2062 unsigned int xid;
2063 int rc = 0; 2063 int rc = 0;
2064 struct cifs_tcon *tcon; 2064 struct cifs_tcon *tcon;
2065 struct TCP_Server_Info *server;
2065 struct cifsFileInfo *smbfile = file->private_data; 2066 struct cifsFileInfo *smbfile = file->private_data;
2066 struct inode *inode = file->f_path.dentry->d_inode; 2067 struct inode *inode = file->f_path.dentry->d_inode;
2067 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 2068 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
@@ -2085,8 +2086,13 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
2085 } 2086 }
2086 2087
2087 tcon = tlink_tcon(smbfile->tlink); 2088 tcon = tlink_tcon(smbfile->tlink);
2088 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) 2089 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) {
2089 rc = CIFSSMBFlush(xid, tcon, smbfile->fid.netfid); 2090 server = tcon->ses->server;
2091 if (server->ops->flush)
2092 rc = server->ops->flush(xid, tcon, &smbfile->fid);
2093 else
2094 rc = -ENOSYS;
2095 }
2090 2096
2091 free_xid(xid); 2097 free_xid(xid);
2092 mutex_unlock(&inode->i_mutex); 2098 mutex_unlock(&inode->i_mutex);
@@ -2098,6 +2104,7 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
2098 unsigned int xid; 2104 unsigned int xid;
2099 int rc = 0; 2105 int rc = 0;
2100 struct cifs_tcon *tcon; 2106 struct cifs_tcon *tcon;
2107 struct TCP_Server_Info *server;
2101 struct cifsFileInfo *smbfile = file->private_data; 2108 struct cifsFileInfo *smbfile = file->private_data;
2102 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 2109 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
2103 struct inode *inode = file->f_mapping->host; 2110 struct inode *inode = file->f_mapping->host;
@@ -2113,8 +2120,13 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
2113 file->f_path.dentry->d_name.name, datasync); 2120 file->f_path.dentry->d_name.name, datasync);
2114 2121
2115 tcon = tlink_tcon(smbfile->tlink); 2122 tcon = tlink_tcon(smbfile->tlink);
2116 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) 2123 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) {
2117 rc = CIFSSMBFlush(xid, tcon, smbfile->fid.netfid); 2124 server = tcon->ses->server;
2125 if (server->ops->flush)
2126 rc = server->ops->flush(xid, tcon, &smbfile->fid);
2127 else
2128 rc = -ENOSYS;
2129 }
2118 2130
2119 free_xid(xid); 2131 free_xid(xid);
2120 mutex_unlock(&inode->i_mutex); 2132 mutex_unlock(&inode->i_mutex);
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index dd64754ed8cb..df20dd9e64ca 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -648,6 +648,13 @@ cifs_close_file(const unsigned int xid, struct cifs_tcon *tcon,
648 return CIFSSMBClose(xid, tcon, fid->netfid); 648 return CIFSSMBClose(xid, tcon, fid->netfid);
649} 649}
650 650
651static int
652cifs_flush_file(const unsigned int xid, struct cifs_tcon *tcon,
653 struct cifs_fid *fid)
654{
655 return CIFSSMBFlush(xid, tcon, fid->netfid);
656}
657
651struct smb_version_operations smb1_operations = { 658struct smb_version_operations smb1_operations = {
652 .send_cancel = send_nt_cancel, 659 .send_cancel = send_nt_cancel,
653 .compare_fids = cifs_compare_fids, 660 .compare_fids = cifs_compare_fids,
@@ -691,6 +698,7 @@ struct smb_version_operations smb1_operations = {
691 .open = cifs_open_file, 698 .open = cifs_open_file,
692 .set_fid = cifs_set_fid, 699 .set_fid = cifs_set_fid,
693 .close = cifs_close_file, 700 .close = cifs_close_file,
701 .flush = cifs_flush_file,
694}; 702};
695 703
696struct smb_version_values smb1_values = { 704struct smb_version_values smb1_values = {