lkml.org 
[lkml]   [2006]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] Don't pass offset == 0 && endbyte == 0 to do_sync_file_range()
From
Date
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);
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-04-03 14:22    [W:3.086 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site