[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <af8490c5-524c-69a8-d128-d0c70a3deb76@linux.alibaba.com>
Date: Wed, 9 Nov 2022 13:35:25 +0800
From: JeffleXu <jefflexu@...ux.alibaba.com>
To: David Howells <dhowells@...hat.com>, willy@...radead.org
Cc: linux-fsdevel@...r.kernel.org, linux-cachefs@...hat.com,
Jeff Layton <jlayton@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [Linux-cachefs] [PATCH v2 2/2] netfs: Fix dodgy maths
On 11/5/22 12:38 AM, David Howells wrote:
> Fix the dodgy maths in netfs_rreq_unlock_folios(). start_page could be
> inside the folio, in which case the calculation of pgpos will be come up
> with a negative number (though for the moment rreq->start is rounded down
> earlier and folios would have to get merged whilst locked)
>
> Alter how this works to just frame the tracking in terms of absolute file
> positions, rather than offsets from the start of the I/O request. This
> simplifies the maths and makes it easier to follow.
>
> Fix the issue by using folio_pos() and folio_size() to calculate the end
> position of the page.
>
> Fixes: 3d3c95046742 ("netfs: Provide readahead and readpage netfs helpers")
> Reported-by: Matthew Wilcox <willy@...radead.org>
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: Jeff Layton <jlayton@...nel.org>
> cc: linux-cachefs@...hat.com
> cc: linux-fsdevel@...r.kernel.org
> Link: https://lore.kernel.org/r/Y2SJw7w1IsIik3nb@casper.infradead.org/
Reviewed-by: Jingbo Xu <jefflexu@...ux.alibaba.com>
--
Thanks,
Jingbo
Powered by blists - more mailing lists