All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: fix offset handling in cifs_iovec_write
@ 2012-04-13 21:16 Jeff Layton
       [not found] ` <1334351819-29402-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2012-04-13 21:16 UTC (permalink / raw)
  To: smfrench-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA

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.

Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/cifs/file.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index fae765d..81725e9 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cifs: fix offset handling in cifs_iovec_write
       [not found] ` <1334351819-29402-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-04-20  3:22   ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2012-04-20  3:22 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA

merged into cifs-2.6.git

On Fri, Apr 13, 2012 at 4:16 PM, Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> 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.
>
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  fs/cifs/file.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index fae765d..81725e9 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -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
>



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-20  3:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 21:16 [PATCH] cifs: fix offset handling in cifs_iovec_write Jeff Layton
     [not found] ` <1334351819-29402-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-20  3:22   ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.