* [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED
@ 2023-06-12 20:24 David Howells
2023-06-13 4:28 ` Christoph Hellwig
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: David Howells @ 2023-06-12 20:24 UTC (permalink / raw)
To: Jens Axboe, David Hildenbrand, kernel test robot
Cc: dhowells, Christoph Hellwig, Andrew Morton, Al Viro,
Matthew Wilcox, Jan Kara, Jeff Layton, Jason Gunthorpe,
Logan Gunthorpe, Hillf Danton, Christian Brauner,
Lorenzo Stoakes, linux-fsdevel, linux-block, linux-mm, oe-lkp,
lkp, linux-kernel
Fix dio_bio_alloc() to set BIO_PAGE_PINNED, not BIO_PAGE_REFFED, so that
the bio code unpins the pinned pages rather than putting a ref on them.
The issue was causing:
WARNING: CPU: 6 PID: 2220 at mm/gup.c:76 try_get_folio
This can be caused by creating a file on a loopback UDF filesystem, opening
it O_DIRECT and making two writes to it from the same source buffer.
Fixes: 1ccf164ec866 ("block: Use iov_iter_extract_pages() and page pinning in direct-io.c")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202306120931.a9606b88-oliver.sang@intel.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Christoph Hellwig <hch@infradead.org>
cc: David Hildenbrand <david@redhat.com>
cc: Andrew Morton <akpm@linux-foundation.org>
cc: Jens Axboe <axboe@kernel.dk>
cc: Al Viro <viro@zeniv.linux.org.uk>
cc: Matthew Wilcox <willy@infradead.org>
cc: Jan Kara <jack@suse.cz>
cc: Jeff Layton <jlayton@kernel.org>
cc: Jason Gunthorpe <jgg@nvidia.com>
cc: Logan Gunthorpe <logang@deltatee.com>
cc: Hillf Danton <hdanton@sina.com>
cc: Christian Brauner <brauner@kernel.org>
cc: Linus Torvalds <torvalds@linux-foundation.org>
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-kernel@vger.kernel.org
cc: linux-mm@kvack.org
---
Notes:
ver #2)
- Remove comment on requiring references for all pages.
fs/direct-io.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 14049204cac8..5d4c5be0fb41 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -414,8 +414,8 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,
bio->bi_end_io = dio_bio_end_aio;
else
bio->bi_end_io = dio_bio_end_io;
- /* for now require references for all pages */
- bio_set_flag(bio, BIO_PAGE_REFFED);
+ if (dio->need_unpin)
+ bio_set_flag(bio, BIO_PAGE_PINNED);
sdio->bio = bio;
sdio->logical_offset_in_bio = sdio->cur_page_fs_offset;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED
2023-06-12 20:24 [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED David Howells
@ 2023-06-13 4:28 ` Christoph Hellwig
2023-06-13 7:31 ` David Hildenbrand
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2023-06-13 4:28 UTC (permalink / raw)
To: David Howells
Cc: Jens Axboe, David Hildenbrand, kernel test robot,
Christoph Hellwig, Andrew Morton, Al Viro, Matthew Wilcox,
Jan Kara, Jeff Layton, Jason Gunthorpe, Logan Gunthorpe,
Hillf Danton, Christian Brauner, Lorenzo Stoakes, linux-fsdevel,
linux-block, linux-mm, oe-lkp, lkp, linux-kernel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED
2023-06-12 20:24 [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED David Howells
2023-06-13 4:28 ` Christoph Hellwig
@ 2023-06-13 7:31 ` David Hildenbrand
2023-06-13 15:48 ` Jens Axboe
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: David Hildenbrand @ 2023-06-13 7:31 UTC (permalink / raw)
To: David Howells, Jens Axboe, kernel test robot
Cc: Christoph Hellwig, Andrew Morton, Al Viro, Matthew Wilcox,
Jan Kara, Jeff Layton, Jason Gunthorpe, Logan Gunthorpe,
Hillf Danton, Christian Brauner, Lorenzo Stoakes, linux-fsdevel,
linux-block, linux-mm, oe-lkp, lkp, linux-kernel
On 12.06.23 22:24, David Howells wrote:
>
> Fix dio_bio_alloc() to set BIO_PAGE_PINNED, not BIO_PAGE_REFFED, so that
> the bio code unpins the pinned pages rather than putting a ref on them.
>
> The issue was causing:
>
> WARNING: CPU: 6 PID: 2220 at mm/gup.c:76 try_get_folio
>
> This can be caused by creating a file on a loopback UDF filesystem, opening
> it O_DIRECT and making two writes to it from the same source buffer.
>
> Fixes: 1ccf164ec866 ("block: Use iov_iter_extract_pages() and page pinning in direct-io.c")
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202306120931.a9606b88-oliver.sang@intel.com
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Christoph Hellwig <hch@infradead.org>
> cc: David Hildenbrand <david@redhat.com>
> cc: Andrew Morton <akpm@linux-foundation.org>
> cc: Jens Axboe <axboe@kernel.dk>
> cc: Al Viro <viro@zeniv.linux.org.uk>
> cc: Matthew Wilcox <willy@infradead.org>
> cc: Jan Kara <jack@suse.cz>
> cc: Jeff Layton <jlayton@kernel.org>
> cc: Jason Gunthorpe <jgg@nvidia.com>
> cc: Logan Gunthorpe <logang@deltatee.com>
> cc: Hillf Danton <hdanton@sina.com>
> cc: Christian Brauner <brauner@kernel.org>
> cc: Linus Torvalds <torvalds@linux-foundation.org>
> cc: linux-fsdevel@vger.kernel.org
> cc: linux-block@vger.kernel.org
> cc: linux-kernel@vger.kernel.org
> cc: linux-mm@kvack.org
> ---
>
> Notes:
> ver #2)
> - Remove comment on requiring references for all pages.
>
> fs/direct-io.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/direct-io.c b/fs/direct-io.c
> index 14049204cac8..5d4c5be0fb41 100644
> --- a/fs/direct-io.c
> +++ b/fs/direct-io.c
> @@ -414,8 +414,8 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,
> bio->bi_end_io = dio_bio_end_aio;
> else
> bio->bi_end_io = dio_bio_end_io;
> - /* for now require references for all pages */
> - bio_set_flag(bio, BIO_PAGE_REFFED);
> + if (dio->need_unpin)
> + bio_set_flag(bio, BIO_PAGE_PINNED);
> sdio->bio = bio;
> sdio->logical_offset_in_bio = sdio->cur_page_fs_offset;
> }
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED
2023-06-12 20:24 [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED David Howells
2023-06-13 4:28 ` Christoph Hellwig
2023-06-13 7:31 ` David Hildenbrand
@ 2023-06-13 15:48 ` Jens Axboe
2023-06-13 16:00 ` David Howells
2023-06-13 16:38 ` David Howells
4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2023-06-13 15:48 UTC (permalink / raw)
To: David Howells, David Hildenbrand, kernel test robot
Cc: Christoph Hellwig, Andrew Morton, Al Viro, Matthew Wilcox,
Jan Kara, Jeff Layton, Jason Gunthorpe, Logan Gunthorpe,
Hillf Danton, Christian Brauner, Lorenzo Stoakes, linux-fsdevel,
linux-block, linux-mm, oe-lkp, lkp, linux-kernel
On 6/12/23 2:24 PM, David Howells wrote:
>
> Fix dio_bio_alloc() to set BIO_PAGE_PINNED, not BIO_PAGE_REFFED, so that
> the bio code unpins the pinned pages rather than putting a ref on them.
>
> The issue was causing:
>
> WARNING: CPU: 6 PID: 2220 at mm/gup.c:76 try_get_folio
>
> This can be caused by creating a file on a loopback UDF filesystem, opening
> it O_DIRECT and making two writes to it from the same source buffer.
What is this against?
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED
2023-06-12 20:24 [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED David Howells
` (2 preceding siblings ...)
2023-06-13 15:48 ` Jens Axboe
@ 2023-06-13 16:00 ` David Howells
2023-06-13 16:38 ` David Howells
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2023-06-13 16:00 UTC (permalink / raw)
To: Jens Axboe
Cc: dhowells, David Hildenbrand, kernel test robot,
Christoph Hellwig, Andrew Morton, Al Viro, Matthew Wilcox,
Jan Kara, Jeff Layton, Jason Gunthorpe, Logan Gunthorpe,
Hillf Danton, Christian Brauner, Lorenzo Stoakes, linux-fsdevel,
linux-block, linux-mm, oe-lkp, lkp, linux-kernel
Jens Axboe <axboe@kernel.dk> wrote:
> What is this against?
It's against the branch I posted. I should rebase it on your tree, but I'm in
a conference at the moment, so that may have to wait till Thursday.
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED
2023-06-12 20:24 [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED David Howells
` (3 preceding siblings ...)
2023-06-13 16:00 ` David Howells
@ 2023-06-13 16:38 ` David Howells
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2023-06-13 16:38 UTC (permalink / raw)
To: Jens Axboe
Cc: dhowells, David Hildenbrand, kernel test robot,
Christoph Hellwig, Andrew Morton, Al Viro, Matthew Wilcox,
Jan Kara, Jeff Layton, Jason Gunthorpe, Logan Gunthorpe,
Hillf Danton, Christian Brauner, Lorenzo Stoakes, linux-fsdevel,
linux-block, linux-mm, oe-lkp, lkp, linux-kernel
David Howells <dhowells@redhat.com> wrote:
> > What is this against?
>
> It's against the branch I posted.
Actually, it's not. It's against an old version of the patch on a different
branch. The patches you have applied already have that change - so the issue
must be something else:-/
David
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-06-13 16:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 20:24 [PATCH v2] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED David Howells
2023-06-13 4:28 ` Christoph Hellwig
2023-06-13 7:31 ` David Hildenbrand
2023-06-13 15:48 ` Jens Axboe
2023-06-13 16:00 ` David Howells
2023-06-13 16:38 ` David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox