Skip to content

Commit

Permalink
msync: fix incorrect fstart calculation
Browse files Browse the repository at this point in the history
Fix a regression caused by 7fc34a6 ("mm/msync.c: sync only the
requested range in msync()").

xfstests generic/075 fail occured on ext4 data=journal mode because the
intended range was not syncing due to wrong fstart calculation.

Signed-off-by: Namjae Jeon <[email protected]>
Signed-off-by: Ashish Sangwan <[email protected]>
Reported-by: Eric Whitney <[email protected]>
Tested-by: Eric Whitney <[email protected]>
Acked-by: Matthew Wilcox <[email protected]>
Reviewed-by: Lukas Czerner <[email protected]>
Tested-by: Lukas Czerner <[email protected]>
Reviewed-by: Theodore Ts'o <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
namjaejeon authored and torvalds committed Jul 3, 2014
1 parent 2e32bae commit 496a8e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/msync.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
goto out_unlock;
}
file = vma->vm_file;
fstart = start + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
fstart = (start - vma->vm_start) +
((loff_t)vma->vm_pgoff << PAGE_SHIFT);
fend = fstart + (min(end, vma->vm_end) - start) - 1;
start = vma->vm_end;
if ((flags & MS_SYNC) && file &&
Expand Down

0 comments on commit 496a8e6

Please sign in to comment.