linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Miklos Szeredi <mszeredi@suse.cz>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Changli Gao <xiaosuo@gmail.com>
Subject: [PATCH v2 4/4] splice: fix updating sd->pos wrongly
Date: Wed, 26 May 2010 22:44:43 +0800	[thread overview]
Message-ID: <1274885083-15735-1-git-send-email-xiaosuo@gmail.com> (raw)

fix updating sd->pos wrongly.

In error path, we don't need to updating sd->pos, if the file isn't seekable.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 fs/splice.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/splice.c b/fs/splice.c
index 57172ca..c69b241 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1185,7 +1185,8 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
 		sd->pos = pos;
 
 		if (ret < read_len) {
-			sd->pos = prev_pos + ret;
+			if (sd->pos)
+				sd->pos = prev_pos + ret;
 			goto out_release;
 		}
 	}

             reply	other threads:[~2010-05-26 14:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26 14:44 Changli Gao [this message]
2010-05-28  9:42 ` [PATCH v2 4/4] splice: fix updating sd->pos wrongly Miklos Szeredi
2010-05-28 10:00   ` Changli Gao
2010-05-28 10:13     ` Miklos Szeredi
2010-05-28 10:55       ` Changli Gao
2010-05-28 11:11         ` Miklos Szeredi
2010-05-28 11:36           ` Changli Gao
2010-05-28 11:40             ` Miklos Szeredi
2010-05-29 14:09         ` Jamie Lokier
2010-05-29 14:22           ` Changli Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274885083-15735-1-git-send-email-xiaosuo@gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).