diff options
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r-- | fs/9p/vfs_file.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 89c849da8504..6852f0eb96ed 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/string.h> | 32 | #include <linux/string.h> |
33 | #include <linux/smp_lock.h> | 33 | #include <linux/smp_lock.h> |
34 | #include <linux/inet.h> | 34 | #include <linux/inet.h> |
35 | #include <linux/version.h> | ||
35 | #include <linux/list.h> | 36 | #include <linux/list.h> |
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | #include <linux/idr.h> | 38 | #include <linux/idr.h> |
@@ -117,9 +118,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
117 | 118 | ||
118 | result = v9fs_t_open(v9ses, newfid, open_mode, &fcall); | 119 | result = v9fs_t_open(v9ses, newfid, open_mode, &fcall); |
119 | if (result < 0) { | 120 | if (result < 0) { |
120 | dprintk(DEBUG_ERROR, | 121 | PRINT_FCALL_ERROR("open failed", fcall); |
121 | "open failed, open_mode 0x%x: %s\n", open_mode, | ||
122 | FCALL_ERROR(fcall)); | ||
123 | kfree(fcall); | 122 | kfree(fcall); |
124 | return result; | 123 | return result; |
125 | } | 124 | } |
@@ -165,8 +164,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) | |||
165 | return -ENOLCK; | 164 | return -ENOLCK; |
166 | 165 | ||
167 | if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { | 166 | if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { |
168 | filemap_fdatawrite(inode->i_mapping); | 167 | filemap_write_and_wait(inode->i_mapping); |
169 | filemap_fdatawait(inode->i_mapping); | ||
170 | invalidate_inode_pages(&inode->i_data); | 168 | invalidate_inode_pages(&inode->i_data); |
171 | } | 169 | } |
172 | 170 | ||
@@ -257,7 +255,6 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
257 | int result = -EIO; | 255 | int result = -EIO; |
258 | int rsize = 0; | 256 | int rsize = 0; |
259 | int total = 0; | 257 | int total = 0; |
260 | char *buf; | ||
261 | 258 | ||
262 | dprintk(DEBUG_VFS, "data %p count %d offset %x\n", data, (int)count, | 259 | dprintk(DEBUG_VFS, "data %p count %d offset %x\n", data, (int)count, |
263 | (int)*offset); | 260 | (int)*offset); |
@@ -265,28 +262,14 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
265 | if (v9fid->iounit != 0 && rsize > v9fid->iounit) | 262 | if (v9fid->iounit != 0 && rsize > v9fid->iounit) |
266 | rsize = v9fid->iounit; | 263 | rsize = v9fid->iounit; |
267 | 264 | ||
268 | buf = kmalloc(v9ses->maxdata - V9FS_IOHDRSZ, GFP_KERNEL); | ||
269 | if (!buf) | ||
270 | return -ENOMEM; | ||
271 | |||
272 | do { | 265 | do { |
273 | if (count < rsize) | 266 | if (count < rsize) |
274 | rsize = count; | 267 | rsize = count; |
275 | 268 | ||
276 | result = copy_from_user(buf, data, rsize); | 269 | result = v9fs_t_write(v9ses, fid, *offset, rsize, data, &fcall); |
277 | if (result) { | ||
278 | dprintk(DEBUG_ERROR, "Problem copying from user\n"); | ||
279 | kfree(buf); | ||
280 | return -EFAULT; | ||
281 | } | ||
282 | |||
283 | dump_data(buf, rsize); | ||
284 | result = v9fs_t_write(v9ses, fid, *offset, rsize, buf, &fcall); | ||
285 | if (result < 0) { | 270 | if (result < 0) { |
286 | eprintk(KERN_ERR, "error while writing: %s(%d)\n", | 271 | PRINT_FCALL_ERROR("error while writing", fcall); |
287 | FCALL_ERROR(fcall), result); | ||
288 | kfree(fcall); | 272 | kfree(fcall); |
289 | kfree(buf); | ||
290 | return result; | 273 | return result; |
291 | } else | 274 | } else |
292 | *offset += result; | 275 | *offset += result; |
@@ -306,7 +289,6 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
306 | total += result; | 289 | total += result; |
307 | } while (count); | 290 | } while (count); |
308 | 291 | ||
309 | kfree(buf); | ||
310 | return total; | 292 | return total; |
311 | } | 293 | } |
312 | 294 | ||