diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-03-08 06:09:49 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-03-22 16:43:36 -0400 |
commit | ea59bb759b8fd240860c37026ab1b998d26ac285 (patch) | |
tree | de7fee45a8c08b7407f1b0d833889ca69154a506 /fs/9p | |
parent | 059c138bc79320bd7d6fba91bad4d50eeec9c31f (diff) |
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>
Diffstat (limited to 'fs/9p')
-rw-r--r-- | fs/9p/fid.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index cd63e002d826..99a1a7b08634 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -286,9 +286,11 @@ static struct p9_fid *v9fs_fid_clone_with_uid(struct dentry *dentry, uid_t uid) | |||
286 | 286 | ||
287 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) | 287 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) |
288 | { | 288 | { |
289 | int err; | 289 | int err, flags; |
290 | struct p9_fid *fid; | 290 | struct p9_fid *fid; |
291 | struct v9fs_session_info *v9ses; | ||
291 | 292 | ||
293 | v9ses = v9fs_inode2v9ses(dentry->d_inode); | ||
292 | fid = v9fs_fid_clone_with_uid(dentry, 0); | 294 | fid = v9fs_fid_clone_with_uid(dentry, 0); |
293 | if (IS_ERR(fid)) | 295 | if (IS_ERR(fid)) |
294 | goto error_out; | 296 | goto error_out; |
@@ -297,8 +299,17 @@ struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) | |||
297 | * dirty pages. We always request for the open fid in read-write | 299 | * dirty pages. We always request for the open fid in read-write |
298 | * mode so that a partial page write which result in page | 300 | * mode so that a partial page write which result in page |
299 | * read can work. | 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 | if (err < 0) { | 313 | if (err < 0) { |
303 | p9_client_clunk(fid); | 314 | p9_client_clunk(fid); |
304 | fid = ERR_PTR(err); | 315 | fid = ERR_PTR(err); |