Commit ea59bb759b8fd240860c37026ab1b998d26ac285

Authored by Aneesh Kumar K.V
Committed by Eric Van Hensbergen
1 parent 059c138bc7

fs/9p: Open writeback fid in O_SYNC mode

Older version of protocol don't support tsyncfs operation.
So for them force a O_SYNC flag on the server

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>

Showing 1 changed file with 13 additions and 2 deletions Side-by-side Diff

... ... @@ -286,9 +286,11 @@
286 286  
287 287 struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
288 288 {
289   - int err;
  289 + int err, flags;
290 290 struct p9_fid *fid;
  291 + struct v9fs_session_info *v9ses;
291 292  
  293 + v9ses = v9fs_inode2v9ses(dentry->d_inode);
292 294 fid = v9fs_fid_clone_with_uid(dentry, 0);
293 295 if (IS_ERR(fid))
294 296 goto error_out;
295 297  
... ... @@ -297,8 +299,17 @@
297 299 * dirty pages. We always request for the open fid in read-write
298 300 * mode so that a partial page write which result in page
299 301 * read can work.
  302 + *
  303 + * we don't have a tsyncfs operation for older version
  304 + * of protocol. So make sure the write back fid is
  305 + * opened in O_SYNC mode.
300 306 */
301   - err = p9_client_open(fid, O_RDWR);
  307 + if (!v9fs_proto_dotl(v9ses))
  308 + flags = O_RDWR | O_SYNC;
  309 + else
  310 + flags = O_RDWR;
  311 +
  312 + err = p9_client_open(fid, flags);
302 313 if (err < 0) {
303 314 p9_client_clunk(fid);
304 315 fid = ERR_PTR(err);