diff options
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r-- | fs/9p/vfs_file.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 3902bf43a088..df52d488d2a6 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -61,7 +61,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
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_extended(v9ses)); | 64 | omode = v9fs_uflags2omode(file->f_flags, v9fs_proto_dotu(v9ses)); |
65 | fid = file->private_data; | 65 | fid = file->private_data; |
66 | if (!fid) { | 66 | if (!fid) { |
67 | fid = v9fs_fid_clone(file->f_path.dentry); | 67 | fid = v9fs_fid_clone(file->f_path.dentry); |
@@ -77,7 +77,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
77 | i_size_write(inode, 0); | 77 | i_size_write(inode, 0); |
78 | inode->i_blocks = 0; | 78 | inode->i_blocks = 0; |
79 | } | 79 | } |
80 | if ((file->f_flags & O_APPEND) && (!v9fs_extended(v9ses))) | 80 | if ((file->f_flags & O_APPEND) && (!v9fs_proto_dotu(v9ses))) |
81 | generic_file_llseek(file, 0, SEEK_END); | 81 | generic_file_llseek(file, 0, SEEK_END); |
82 | } | 82 | } |
83 | 83 | ||
@@ -114,7 +114,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) | |||
114 | P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); | 114 | P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); |
115 | 115 | ||
116 | /* No mandatory locks */ | 116 | /* No mandatory locks */ |
117 | if (__mandatory_lock(inode)) | 117 | if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) |
118 | return -ENOLCK; | 118 | return -ENOLCK; |
119 | 119 | ||
120 | if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { | 120 | if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { |
@@ -215,7 +215,7 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
215 | struct p9_fid *fid; | 215 | struct p9_fid *fid; |
216 | struct p9_client *clnt; | 216 | struct p9_client *clnt; |
217 | struct inode *inode = filp->f_path.dentry->d_inode; | 217 | struct inode *inode = filp->f_path.dentry->d_inode; |
218 | int origin = *offset; | 218 | loff_t origin = *offset; |
219 | unsigned long pg_start, pg_end; | 219 | unsigned long pg_start, pg_end; |
220 | 220 | ||
221 | P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data, | 221 | P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data, |
@@ -257,6 +257,23 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
257 | return total; | 257 | return total; |
258 | } | 258 | } |
259 | 259 | ||
260 | static int v9fs_file_fsync(struct file *filp, struct dentry *dentry, | ||
261 | int datasync) | ||
262 | { | ||
263 | struct p9_fid *fid; | ||
264 | struct p9_wstat wstat; | ||
265 | int retval; | ||
266 | |||
267 | P9_DPRINTK(P9_DEBUG_VFS, "filp %p dentry %p datasync %x\n", filp, | ||
268 | dentry, datasync); | ||
269 | |||
270 | fid = filp->private_data; | ||
271 | v9fs_blank_wstat(&wstat); | ||
272 | |||
273 | retval = p9_client_wstat(fid, &wstat); | ||
274 | return retval; | ||
275 | } | ||
276 | |||
260 | static const struct file_operations v9fs_cached_file_operations = { | 277 | static const struct file_operations v9fs_cached_file_operations = { |
261 | .llseek = generic_file_llseek, | 278 | .llseek = generic_file_llseek, |
262 | .read = do_sync_read, | 279 | .read = do_sync_read, |
@@ -266,6 +283,7 @@ static const struct file_operations v9fs_cached_file_operations = { | |||
266 | .release = v9fs_dir_release, | 283 | .release = v9fs_dir_release, |
267 | .lock = v9fs_file_lock, | 284 | .lock = v9fs_file_lock, |
268 | .mmap = generic_file_readonly_mmap, | 285 | .mmap = generic_file_readonly_mmap, |
286 | .fsync = v9fs_file_fsync, | ||
269 | }; | 287 | }; |
270 | 288 | ||
271 | const struct file_operations v9fs_file_operations = { | 289 | const struct file_operations v9fs_file_operations = { |
@@ -276,4 +294,5 @@ const struct file_operations v9fs_file_operations = { | |||
276 | .release = v9fs_dir_release, | 294 | .release = v9fs_dir_release, |
277 | .lock = v9fs_file_lock, | 295 | .lock = v9fs_file_lock, |
278 | .mmap = generic_file_readonly_mmap, | 296 | .mmap = generic_file_readonly_mmap, |
297 | .fsync = v9fs_file_fsync, | ||
279 | }; | 298 | }; |