aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/9p/vfs_file.c13
-rw-r--r--include/net/9p/9p.h2
-rw-r--r--net/9p/client.c17
3 files changed, 21 insertions, 11 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 2d686ec322a0..e97c92bd6f16 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -59,9 +59,13 @@ int v9fs_file_open(struct inode *inode, struct file *file)
59 struct p9_fid *fid; 59 struct p9_fid *fid;
60 int omode; 60 int omode;
61 61
62 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p \n", inode, file); 62 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
63 v9ses = v9fs_inode2v9ses(inode); 63 v9ses = v9fs_inode2v9ses(inode);
64 omode = v9fs_uflags2omode(file->f_flags, v9fs_proto_dotu(v9ses)); 64 if (v9fs_proto_dotl(v9ses))
65 omode = file->f_flags;
66 else
67 omode = v9fs_uflags2omode(file->f_flags,
68 v9fs_proto_dotu(v9ses));
65 fid = file->private_data; 69 fid = file->private_data;
66 if (!fid) { 70 if (!fid) {
67 fid = v9fs_fid_clone(file->f_path.dentry); 71 fid = v9fs_fid_clone(file->f_path.dentry);
@@ -73,11 +77,12 @@ int v9fs_file_open(struct inode *inode, struct file *file)
73 p9_client_clunk(fid); 77 p9_client_clunk(fid);
74 return err; 78 return err;
75 } 79 }
76 if (omode & P9_OTRUNC) { 80 if (file->f_flags & O_TRUNC) {
77 i_size_write(inode, 0); 81 i_size_write(inode, 0);
78 inode->i_blocks = 0; 82 inode->i_blocks = 0;
79 } 83 }
80 if ((file->f_flags & O_APPEND) && (!v9fs_proto_dotu(v9ses))) 84 if ((file->f_flags & O_APPEND) &&
85 (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)))
81 generic_file_llseek(file, 0, SEEK_END); 86 generic_file_llseek(file, 0, SEEK_END);
82 } 87 }
83 88
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 06d111d61038..cf580a40e299 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -139,6 +139,8 @@ do { \
139enum p9_msg_t { 139enum p9_msg_t {
140 P9_TSTATFS = 8, 140 P9_TSTATFS = 8,
141 P9_RSTATFS, 141 P9_RSTATFS,
142 P9_TLOPEN = 12,
143 P9_RLOPEN,
142 P9_TLCREATE = 14, 144 P9_TLCREATE = 14,
143 P9_RLCREATE, 145 P9_RLCREATE,
144 P9_TSYMLINK = 16, 146 P9_TSYMLINK = 16,
diff --git a/net/9p/client.c b/net/9p/client.c
index e580409b1052..c458e042d384 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1016,14 +1016,18 @@ int p9_client_open(struct p9_fid *fid, int mode)
1016 struct p9_qid qid; 1016 struct p9_qid qid;
1017 int iounit; 1017 int iounit;
1018 1018
1019 P9_DPRINTK(P9_DEBUG_9P, ">>> TOPEN fid %d mode %d\n", fid->fid, mode);
1020 err = 0;
1021 clnt = fid->clnt; 1019 clnt = fid->clnt;
1020 P9_DPRINTK(P9_DEBUG_9P, ">>> %s fid %d mode %d\n",
1021 p9_is_proto_dotl(clnt) ? "TLOPEN" : "TOPEN", fid->fid, mode);
1022 err = 0;
1022 1023
1023 if (fid->mode != -1) 1024 if (fid->mode != -1)
1024 return -EINVAL; 1025 return -EINVAL;
1025 1026
1026 req = p9_client_rpc(clnt, P9_TOPEN, "db", fid->fid, mode); 1027 if (p9_is_proto_dotl(clnt))
1028 req = p9_client_rpc(clnt, P9_TLOPEN, "dd", fid->fid, mode);
1029 else
1030 req = p9_client_rpc(clnt, P9_TOPEN, "db", fid->fid, mode);
1027 if (IS_ERR(req)) { 1031 if (IS_ERR(req)) {
1028 err = PTR_ERR(req); 1032 err = PTR_ERR(req);
1029 goto error; 1033 goto error;
@@ -1035,10 +1039,9 @@ int p9_client_open(struct p9_fid *fid, int mode)
1035 goto free_and_error; 1039 goto free_and_error;
1036 } 1040 }
1037 1041
1038 P9_DPRINTK(P9_DEBUG_9P, "<<< ROPEN qid %x.%llx.%x iounit %x\n", 1042 P9_DPRINTK(P9_DEBUG_9P, "<<< %s qid %x.%llx.%x iounit %x\n",
1039 qid.type, 1043 p9_is_proto_dotl(clnt) ? "RLOPEN" : "ROPEN", qid.type,
1040 (unsigned long long)qid.path, 1044 (unsigned long long)qid.path, qid.version, iounit);
1041 qid.version, iounit);
1042 1045
1043 fid->mode = mode; 1046 fid->mode = mode;
1044 fid->iounit = iounit; 1047 fid->iounit = iounit;