On Fri, 27 Jun 2014, Namjae Jeon wrote: > Date: Fri, 27 Jun 2014 20:38:49 +0900 > From: Namjae Jeon <namjae.jeon@xxxxxxxxxxx> > To: 'Andrew Morton' <akpm@xxxxxxxxxxxxxxxxxxxx> > Cc: linux-mm@xxxxxxxxx, linux-ext4 <linux-ext4@xxxxxxxxxxxxxxx>, > Lukáš Czerner <lczerner@xxxxxxxxxx>, > 'Matthew Wilcox' <matthew.r.wilcox@xxxxxxxxx>, > 'Eric Whitney' <enwlinux@xxxxxxxxx>, > Ashish Sangwan <a.sangwan@xxxxxxxxxxx> > Subject: [PATCH] msync: fix incorrect fstart calculation > > Fix a regression caused by Commit 7fc34a62ca 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. Looks good to me and it fixes the issues with data=journal on ext4. Reviewed-by: Lukas Czerner <lczerner@xxxxxxxxxx> Tested-by: Lukas Czerner <lczerner@xxxxxxxxxx> > > Cc: Matthew Wilcox <matthew.r.wilcox@xxxxxxxxx> > Cc: Lukáš Czerner <lczerner@xxxxxxxxxx> > Reported-by: Eric Whitney <enwlinux@xxxxxxxxx> > Signed-off-by: Namjae Jeon <namjae.jeon@xxxxxxxxxxx> > Signed-off-by: Ashish Sangwan <a.sangwan@xxxxxxxxxxx> > --- > mm/msync.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/msync.c b/mm/msync.c > index a5c6736..ad97dce 100644 > --- a/mm/msync.c > +++ b/mm/msync.c > @@ -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 && >