mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
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>
This commit is contained in:
parent
059c138bc7
commit
ea59bb759b
1 changed files with 13 additions and 2 deletions
15
fs/9p/fid.c
15
fs/9p/fid.c
|
@ -286,9 +286,11 @@ static struct p9_fid *v9fs_fid_clone_with_uid(struct dentry *dentry, uid_t uid)
|
||||||
|
|
||||||
struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
|
struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
int err;
|
int err, flags;
|
||||||
struct p9_fid *fid;
|
struct p9_fid *fid;
|
||||||
|
struct v9fs_session_info *v9ses;
|
||||||
|
|
||||||
|
v9ses = v9fs_inode2v9ses(dentry->d_inode);
|
||||||
fid = v9fs_fid_clone_with_uid(dentry, 0);
|
fid = v9fs_fid_clone_with_uid(dentry, 0);
|
||||||
if (IS_ERR(fid))
|
if (IS_ERR(fid))
|
||||||
goto error_out;
|
goto error_out;
|
||||||
|
@ -297,8 +299,17 @@ struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
|
||||||
* dirty pages. We always request for the open fid in read-write
|
* dirty pages. We always request for the open fid in read-write
|
||||||
* mode so that a partial page write which result in page
|
* mode so that a partial page write which result in page
|
||||||
* read can work.
|
* read can work.
|
||||||
|
*
|
||||||
|
* we don't have a tsyncfs operation for older version
|
||||||
|
* of protocol. So make sure the write back fid is
|
||||||
|
* opened in O_SYNC mode.
|
||||||
*/
|
*/
|
||||||
err = p9_client_open(fid, O_RDWR);
|
if (!v9fs_proto_dotl(v9ses))
|
||||||
|
flags = O_RDWR | O_SYNC;
|
||||||
|
else
|
||||||
|
flags = O_RDWR;
|
||||||
|
|
||||||
|
err = p9_client_open(fid, flags);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
p9_client_clunk(fid);
|
p9_client_clunk(fid);
|
||||||
fid = ERR_PTR(err);
|
fid = ERR_PTR(err);
|
||||||
|
|
Loading…
Reference in a new issue