From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Thu, 28 Jan 2016 13:29:18 +0000 Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Fix direct IO write rounding error In-Reply-To: <1461737039.16958702.1453987493013.JavaMail.zimbra@redhat.com> References: <1461737039.16958702.1453987493013.JavaMail.zimbra@redhat.com> Message-ID: <56AA17AE.9050709@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, On 28/01/16 13:24, Bob Peterson wrote: > Hi, > > The fsx test in xfstests was failing because it was using direct IO > writes which were using a bad calculation. It was using > loff_t lstart = offset & (PAGE_CACHE_SIZE - 1); when it should be > loff_t lstart = offset & ~(PAGE_CACHE_SIZE - 1); > Thus, the write at offset 0x67e00 was calculating lstart to be > 0xe00, the address of our corruption. Instead, it should have been > 0x67000. This patch fixes the calculation. > > Regards, > > Bob Peterson > Red Hat File Systems > > Signed-off-by: Bob Peterson Acked-by: Steven Whitehouse Steve. > --- > diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c > index 93f0746..aa016e4 100644 > --- a/fs/gfs2/aops.c > +++ b/fs/gfs2/aops.c > @@ -1082,7 +1082,7 @@ static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter, > * the first place, mapping->nr_pages will always be zero. > */ > if (mapping->nrpages) { > - loff_t lstart = offset & (PAGE_CACHE_SIZE - 1); > + loff_t lstart = offset & ~(PAGE_CACHE_SIZE - 1); > loff_t len = iov_iter_count(iter); > loff_t end = PAGE_ALIGN(offset + len) - 1; > >