cifs: fix offset handling in cifs_iovec_write
Subsystems (2)
PATCH 1/1 cifs: fix offset handling in cifs_iovec_write
In the recent update of the cifs_iovec_write code to use async writes, the handling of the file position was broken. That patch added a local "offset" variable to handle the offset, and then only updated the original "*poffset" before exiting.
Unfortunately, it copied off the original offset from the beginning, instead of doing so after generic_write_checks had been called. Fix this by moving the initialization of "offset" after that in the function.
--- fs/cifs/file.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
fs/cifs/file.c +2 -1
@@ -2178,7 +2178,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,unsigned long nr_pages, i;size_t copied, len, cur_len;ssize_t total_written =0 ; -loff_t offset = *poffset; +loff_t offset;struct iov_iter it;struct cifsFileInfo *open_file;struct cifs_tcon *tcon;
@@ -2200,6 +2200,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov, cifs_sb =CIFS_SB (file->f_path.dentry->d_sb); open_file = file->private_data; tcon =tlink_tcon (open_file->tlink); + offset = *poffset;if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_RWPIDFORWARD ) pid = open_file->pid;
Signature · 1 line
1.7.7.6
A message that is not in the archive (sent off-list or not yet received): 1334351819-29402-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Steve French
Appliedmerged into cifs-2.6.git
Quoted 39 lines · Jeff Layton
In the recent update of the
cifs_iovec_writecode to use async writes, the handling of the file position was broken. That patch added a local "offset" variable to handle the offset, and then only updated the original "*poffset" before exiting.Unfortunately, it copied off the original offset from the beginning, instead of doing so after
generic_write_checkshad been called. Fix this by moving the initialization of "offset" after that in the function.Signed-off-by Jeff Layton <[email protected]>---
fs/cifs/file.c | 3 ++-1 files changed, 2 insertions(+), 1 deletions(-)fs/cifs/file.c +2
-2@@ -2178,7 +2178,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov, unsigned long nr_pages, i; size_t copied, len, cur_len; ssize_t total_written = 0; - loff_t offset = *poffset; + loff_t offset; struct iov_iter it; struct cifsFileInfo *open_file; struct cifs_tcon *tcon;@@ -2200,6 +2200,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov, cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); open_file = file->private_data; tcon = tlink_tcon(open_file->tlink); + offset = *poffset; if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) pid = open_file->pid; --1.7.7.6
Signature · 3 lines
Thanks, Steve