mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Don't pass offset == 0 && endbyte == 0 to do_sync_file_range()
@ 2006-04-01 21:22 OGAWA Hirofumi
  2006-04-02  2:05 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: OGAWA Hirofumi @ 2006-04-01 21:22 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

If user is specifying offset == 0 and nbytes == 1, current code uses
wbc->start == 0 && wbc->end == 0 to flush the range.

However, wbc->start == 0 && wbc->end == 0 is special range, not 0th page.
[If wbc->sync_mode == WB_SYNC_NODE, it uses prev offset.  Otherwise it
uses whole of file.]

It may confuse user, so, don't export that behavior to userland.

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

 fs/sync.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff -puN fs/sync.c~sync_file_range-fix fs/sync.c
--- linux-2.6/fs/sync.c~sync_file_range-fix	2006-04-02 06:20:52.000000000 +0900
+++ linux-2.6-hirofumi/fs/sync.c	2006-04-02 06:20:52.000000000 +0900
@@ -101,8 +101,14 @@ asmlinkage long sys_sync_file_range(int 
 
 	if (nbytes == 0)
 		endbyte = -1;
-	else
-		endbyte--;		/* inclusive */
+	else {
+		/*
+		 * wbc->start == 0 && wbc->end == 0 is a special range,
+		 * so this avoids using it.
+		 */
+		if (endbyte > 1)
+			endbyte--;		/* inclusive */
+	}
 
 	ret = -EBADF;
 	file = fget_light(fd, &fput_needed);
_

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

end of thread, other threads:[~2006-04-02  2:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-01 21:22 [PATCH] Don't pass offset == 0 && endbyte == 0 to do_sync_file_range() OGAWA Hirofumi
2006-04-02  2:05 ` Andrew Morton
2006-04-02  2:21   ` OGAWA Hirofumi

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

all inboxes | Powered by JetHome®