diff options
author | M. Mohan Kumar <mohan@in.ibm.com> | 2010-02-08 16:36:48 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@arly004.austin.ibm.com> | 2010-02-08 16:36:48 -0500 |
commit | 7a4439c406c21b1e900ed497cec1a79d05b38c07 (patch) | |
tree | 82f24249a7e970dc089406d334bd5d49cfecb7d1 /fs/9p/vfs_file.c | |
parent | 9d6939dac77102b09396ee0b89392ec7639612a7 (diff) |
9p: Include fsync support for 9p client
Implement the fsync in the client side by marking stat field values to 'don't touch' so that server may
interpret it as a request to guarantee that the contents of the associated file are committed to stable
storage before the Rwstat message is returned.
Without this patch, calling fsync on a 9p file results in "Invalid argument" error. Please check the attached
C program.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r-- | fs/9p/vfs_file.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 3902bf43a088..74a0461a9ac0 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -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 | }; |