Skip to contentSkip to conversation

fs/9p: Use updated offset for writing

PATCH Superseded M. Mohan Kumar 2 participants 3 messages Mar 16, 2011

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/9p: Use updated offset for writing

Use the updated offset given by generic_write_checks. Without this fix, even if a file is opened in O_APPEND mode, data will be written at current file position instead of end of file.

---
 fs/9p/vfs_file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/9p/vfs_file.c +1 -1
index 6997eb6..51049cd 100644
@@ -510,7 +510,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
 
 	return v9fs_file_write_internal(filp->f_path.dentry->d_inode,
 					filp->private_data,
-					data, count, offset, 1);
+					data, count, &origin, 1);
 out:
 	return retval;
 }
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 14 lines · M. Mohan Kumar

Use the updated offset given by generic_write_checks. Without this fix, even if a file is opened in O_APPEND mode, data will be written at current file position instead of end of file.

---
 fs/9p/vfs_file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/9p/vfs_file.c +0 -0
index 6997eb6..51049cd 100644

fs/9p/vfs_file.c v9fs_file_write(struct file *filp, const char __user * data, · line 516

Quoted 8 lines
fs/9p/vfs_file.c +1 -1
@@ -510,7 +510,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
 
 	return v9fs_file_write_internal(filp->f_path.dentry->d_inode,
 					filp->private_data,
-					data, count, offset, 1);
+					data, count, &origin, 1);
 out:
 	return retval;
 }

You should also update offset on success.

-aneesh

#2 lore raw
Quoted 1 line · Aneesh Kumar K. V

On Wed, 16 Mar 2011 10:39:16 +0530, "M. Mohan Kumar" <[email protected]>

Quoted 6 lines · wrote:
Quoted 3 lines

Use the updated offset given by generic_write_checks. Without this fix, even if a file is opened in O_APPEND mode, data will be written at current file position instead of end of file.

You should also update offset on success.

Thanks Aneesh, I will send a updated patch.

----
M. Mohan Kumar