linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Jamie Lokier <jamie@shareable.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	axboe@kernel.dk, viro@zeniv.linux.org.uk, mszeredi@suse.cz,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] splice: fix updating sd->pos wrongly
Date: Sat, 29 May 2010 22:22:54 +0800	[thread overview]
Message-ID: <AANLkTikycDykLRPnRZFAbdIszTOMDVFoX4DGiLcCvSqd@mail.gmail.com> (raw)
In-Reply-To: <20100529140901.GD3106@shareable.org>

On Sat, May 29, 2010 at 10:09 PM, Jamie Lokier <jamie@shareable.org> wrote:
>
> Not true if the "file" is /dev/mem or /dev/kmem.  The starting offset
> can be negative, so can end at zero.
>
> It's an obscure case and I don't know if you can sendfile from
> /dev/{,k}mem anyway :-) but illustrates why sd->pos != 0 is dubious.
>

So the safe way is checking if splice_read() updates pos or not, isn't it?

if (sd->pos != prev_pos)
    sd->pos = prev_pos + ret;


-- 
Regards,
Changli Gao(xiaosuo@gmail.com)

      reply	other threads:[~2010-05-29 14:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26 14:44 [PATCH v2 4/4] splice: fix updating sd->pos wrongly Changli Gao
2010-05-28  9:42 ` 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 [this message]

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=AANLkTikycDykLRPnRZFAbdIszTOMDVFoX4DGiLcCvSqd@mail.gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=jamie@shareable.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --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).