Skip to contentSkip to conversation

fs/9p: Use updated offset for writing

PATCH In review M. Mohan Kumar 3 participants 3 messages Mar 16, 2011 – Mar 20, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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 |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
fs/9p/vfs_file.c +5 -2
index 6997eb6..ffed558 100644
@@ -508,9 +508,12 @@ v9fs_file_write(struct file *filp, const char __user * data,
 	if (!count)
 		goto out;
 
-	return v9fs_file_write_internal(filp->f_path.dentry->d_inode,
+	retval = v9fs_file_write_internal(filp->f_path.dentry->d_inode,
 					filp->private_data,
-					data, count, offset, 1);
+					data, count, &origin, 1);
+	/* update offset on successful write */
+	if (retval > 0)
+		*offset = origin;
 out:
 	return retval;
 }
Signature · 1 line
1.7.3.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 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.

Eric,

I guess this should go in this merge window ?

Quoted 23 lines
---
 fs/9p/vfs_file.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
fs/9p/vfs_file.c +5 -2
index 6997eb6..ffed558 100644
@@ -508,9 +508,12 @@ v9fs_file_write(struct file *filp, const char __user * data,
 	if (!count)
 		goto out;
 
-	return v9fs_file_write_internal(filp->f_path.dentry->d_inode,
+	retval = v9fs_file_write_internal(filp->f_path.dentry->d_inode,
 					filp->private_data,
-					data, count, offset, 1);
+					data, count, &origin, 1);
+	/* update offset on successful write */
+	if (retval > 0)
+		*offset = origin;
 out:
 	return retval;
 }
#2 lore raw

Yeah, probably a good idea, if we don't make it in time these are actually fixes so we can bring them in during -rc1.

Quoted 38 lines · Aneesh Kumar K. V
Quoted 5 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.

Eric,

I guess this should go in this merge window ?

Quoted 20 lines

---
 fs/9p/vfs_file.c |    7 +++++--

 1 files changed, 5 insertions(+), 2 deletions(-)
fs/9p/vfs_file.c +5 -2
index 6997eb6..ffed558 100644
@@ -508,9 +508,12 @@ v9fs_file_write(struct file *filp, const char __user * data,
       if (!count)
               goto out;
 
-     return v9fs_file_write_internal(filp->f_path.dentry->d_inode,
+     retval = v9fs_file_write_internal(filp->f_path.dentry->d_inode,
                                       filp->private_data,
-                                     data, count, offset, 1);
+                                     data, count, &origin, 1);
+     /* update offset on successful write */
+     if (retval > 0)
+             *offset = origin;
Quoted 3 lines

 out:
      return retval;
 }

------------------------------------------------------------------------------

Quoted 9 lines

Colocation vs. Managed Hosting
A question and answer guide to determining the best fit for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
V9fs-developer mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html