public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] splice: fix wrong __splice_from_pipe() usage
@ 2007-07-16  0:38 OGAWA Hirofumi
  2007-07-16  6:34 ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: OGAWA Hirofumi @ 2007-07-16  0:38 UTC (permalink / raw)
  To: jens.axboe; +Cc: linux-kernel

Hi,

I've noticed the nfsd read corruption by recent change. And this patch
fixes the problem for me, is this right fix?
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>


__splice_from_pipe() is updating the sd->pos for the actor, but those
functions are passing the sd of reader side directory. So, splice
updates sd->pos twice.

This fixes usage of __splice_from_pipe().

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 drivers/block/loop.c |    5 +++--
 fs/nfsd/vfs.c        |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff -puN fs/nfsd/vfs.c~splice-fix-__splice_from_pipe-usage fs/nfsd/vfs.c
--- linux-2.6/fs/nfsd/vfs.c~splice-fix-__splice_from_pipe-usage	2007-07-16 09:30:10.000000000 +0900
+++ linux-2.6-hirofumi/fs/nfsd/vfs.c	2007-07-16 09:30:10.000000000 +0900
@@ -842,9 +842,10 @@ nfsd_splice_actor(struct pipe_inode_info
 }
 
 static int nfsd_direct_splice_actor(struct pipe_inode_info *pipe,
-				    struct splice_desc *sd)
+				    struct splice_desc *__sd)
 {
-	return __splice_from_pipe(pipe, sd, nfsd_splice_actor);
+	struct splice_desc sd = *__sd;
+	return __splice_from_pipe(pipe, &sd, nfsd_splice_actor);
 }
 
 static __be32
diff -puN drivers/block/loop.c~splice-fix-__splice_from_pipe-usage drivers/block/loop.c
--- linux-2.6/drivers/block/loop.c~splice-fix-__splice_from_pipe-usage	2007-07-16 09:30:10.000000000 +0900
+++ linux-2.6-hirofumi/drivers/block/loop.c	2007-07-16 09:30:10.000000000 +0900
@@ -437,9 +437,10 @@ lo_splice_actor(struct pipe_inode_info *
 }
 
 static int
-lo_direct_splice_actor(struct pipe_inode_info *pipe, struct splice_desc *sd)
+lo_direct_splice_actor(struct pipe_inode_info *pipe, struct splice_desc *__sd)
 {
-	return __splice_from_pipe(pipe, sd, lo_splice_actor);
+	struct splice_desc sd = *__sd;
+	return __splice_from_pipe(pipe, &sd, lo_splice_actor);
 }
 
 static int
_

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

end of thread, other threads:[~2007-07-16 12:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-16  0:38 [PATCH] splice: fix wrong __splice_from_pipe() usage OGAWA Hirofumi
2007-07-16  6:34 ` Jens Axboe
2007-07-16 10:53   ` OGAWA Hirofumi
2007-07-16 11:15     ` Jens Axboe
2007-07-16 12:35       ` OGAWA Hirofumi
2007-07-16 12:37         ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox