Thread (5 messages) read the whole thread 5 messages, 3 authors, 2022-07-05

Re: [PATCH 3/3] block: fix leaking page ref on truncated direct io

From: Keith Busch <kbusch@kernel.org>
Date: 2022-07-05 16:15:02
Also in: linux-fsdevel

On Tue, Jul 05, 2022 at 04:54:18PM +0100, Al Viro wrote:
On Tue, Jul 05, 2022 at 08:45:06AM -0700, Keith Busch wrote:
quoted
From: Keith Busch <kbusch@kernel.org>

The size being added to a bio from an iov is aligned to a block size
after the pages were gotten. If the new aligned size truncates the last
page, its reference was being leaked. Ensure all pages that were not
added to the bio have their reference released.

Since this essentially requires doing the same that bio_put_pages(), and
there was only one caller for that function, this patch makes the
put_page() loop common for everyone.

Fixes: b1a000d3b8ec5 ("block: relax direct io memory alignment")
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
I still very much dislike this.  Background: iov_iter_get_pages should
advance the fucking iterator by the amount it has grabbed.  It's
really much cleaner that way.  So your round-down-then-fuck-off-if-zero
is going to be a clumsy.
I currently don't see a better way to do it, but I'll be happy if you come up
with something.
Whatever; I can deal with that on top of your patch.  Where would you
have it go wrt tree?  Could you do a branch based at the last of your
original series, so that both Jens and I could pull from it?
Branch pushed here:

https://git.kernel.org/pub/scm/linux/kernel/git/kbusch/linux.git/log/?h=alignment-fixes-rebased
 
One thing I would really like to avoid is having the entire #for-5.20/block
in ancestors of those commits; that would make for a monumental headache
with iov_iter series ;-/
I'm sorry this is clashing with your work. Please let me know if there's
anything else I can do to help.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help