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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
> > From: Keith Busch <kbusch@xxxxxxxxxx>
> > 
> > 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@xxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Keith Busch <kbusch@xxxxxxxxxx>
> 
> 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.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux