From: Al Viro <viro@zeniv.linux.org.uk>
To: Keith Busch <kbusch@fb.com>
Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
Jens Axboe <axboe@kernel.dk>, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH 3/3] block: fix leaking page ref on truncated direct io
Date: Tue, 5 Jul 2022 16:54:18 +0100 [thread overview]
Message-ID: <YsReqmngB2MLvYrC@ZenIV> (raw)
In-Reply-To: <20220705154506.2993693-3-kbusch@fb.com>
On Tue, Jul 05, 2022 at 08:45:06AM -0700, Keith Busch wrote:
> 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.
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?
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 ;-/
next prev parent reply other threads:[~2022-07-05 15:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 15:45 [PATCH 1/3] block: ensure iov_iter advances for added pages Keith Busch
2022-07-05 15:45 ` [PATCH 2/3] block: ensure bio_iov_add_page can't fail Keith Busch
2022-07-05 15:45 ` [PATCH 3/3] block: fix leaking page ref on truncated direct io Keith Busch
2022-07-05 15:54 ` Al Viro [this message]
2022-07-05 16:14 ` Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YsReqmngB2MLvYrC@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=axboe@kernel.dk \
--cc=kbusch@fb.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox