Re: [dm-devel] [PATCH v6 15/20] md: raid1: check if adding pages to resync bio fails

2023-05-30 Thread Song Liu
On Tue, May 30, 2023 at 9:25 PM Christoph Hellwig wrote: > > To me these look like __bio_add_page candidates, but I guess Song > preferred it this way? It'll add a bit pointless boilerplate code, > but I'm ok with that. We had some discussion on this in v2, and decided to keep these assert-like

Re: [dm-devel] [PATCH v6 08/20] jfs: logmgr: use __bio_add_page to add single page to bio

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 20/20] block: mark bio_add_folio as __must_check

2023-05-30 Thread Christoph Hellwig
On Tue, May 30, 2023 at 08:49:23AM -0700, Johannes Thumshirn wrote: > +bool __must_check bio_add_folio(struct bio *, struct folio *, size_t len, > size_t off); Please spell out the parameters and avoid the overly long line. -- dm-devel mailing list dm-devel@redhat.com

Re: [dm-devel] [PATCH v6 19/20] fs: iomap: use __bio_add_folio where possible

2023-05-30 Thread Christoph Hellwig
On Tue, May 30, 2023 at 08:49:22AM -0700, Johannes Thumshirn wrote: > When the iomap buffered-io code can't add a folio to a bio, it allocates a > new bio and adds the folio to that one. This is done using bio_add_folio(), > but doesn't check for errors. > > As adding a folio to a newly created

Re: [dm-devel] [PATCH v6 18/20] block: add __bio_add_folio

2023-05-30 Thread Christoph Hellwig
On Tue, May 30, 2023 at 08:49:21AM -0700, Johannes Thumshirn wrote: > Just like for bio_add_pages() add a no-fail variant for bio_add_folio(). Can we call this bio_add_folio_nofail? I really regret the __ prefix for bio_add_page these days - it wasn't really intended to be used as widely

Re: [dm-devel] [PATCH v6 17/20] block: mark bio_add_page as __must_check

2023-05-30 Thread Christoph Hellwig
> +int __must_check bio_add_page(struct bio *, struct page *, unsigned len, > unsigned off); Please spell out all parameters while you touch this, and also avoid the overly long line. -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 15/20] md: raid1: check if adding pages to resync bio fails

2023-05-30 Thread Christoph Hellwig
To me these look like __bio_add_page candidates, but I guess Song preferred it this way? It'll add a bit pointless boilerplate code, but I'm ok with that. -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 14/20] md: raid1: use __bio_add_page for adding single page to bio

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 13/20] md: check for failure when adding pages in alloc_behind_master_bio

2023-05-30 Thread Christoph Hellwig
On Tue, May 30, 2023 at 08:49:16AM -0700, Johannes Thumshirn wrote: > alloc_behind_master_bio() can possibly add multiple pages to a bio, but it > is not checking for the return value of bio_add_page() if adding really > succeeded. > > Check if the page adding succeeded and if not bail out. > >

Re: [dm-devel] [PATCH v6 12/20] floppy: use __bio_add_page for adding single page to bio

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 11/20] zram: use __bio_add_page for adding single page to bio

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 10/20] zonefs: use __bio_add_page for adding single page to bio

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 09/20] gfs2: use __bio_add_page for adding single page to bio

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 07/20] md: raid5: use __bio_add_page to add single page to new bio

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 06/20] md: raid5-log: use __bio_add_page to add single page

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 05/20] md: use __bio_add_page to add single page

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 04/20] fs: buffer: use __bio_add_page to add single page to bio

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v6 01/20] swap: use __bio_add_page to add page to bio

2023-05-30 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] fuzzing bcachefs with dm-flakey

2023-05-30 Thread Kent Overstreet
On Tue, May 30, 2023 at 05:00:39PM -0400, Mikulas Patocka wrote: > I'd like to know how do you want to do coverage analysis? By instrumenting > each branch and creating a test case that tests that the branch goes both > ways? Documentation/dev-tools/gcov.rst. The compiler instruments each

Re: [dm-devel] [vdo-devel] [PATCH v2 00/39] Add the dm-vdo deduplication and compression device mapper target.

2023-05-30 Thread Matthew Sakai
On 5/23/23 18:40, Eric Biggers wrote: On Tue, May 23, 2023 at 05:45:00PM -0400, J. corwin Coburn wrote: The dm-vdo target provides inline deduplication, compression, zero-block elimination, and thin provisioning. A dm-vdo target can be backed by up to 256TB of storage, and can present a logical

Re: [dm-devel] fuzzing bcachefs with dm-flakey

2023-05-30 Thread Mikulas Patocka
On Mon, 29 May 2023, Kent Overstreet wrote: > On Mon, May 29, 2023 at 04:59:40PM -0400, Mikulas Patocka wrote: > > Hi > > > > I improved the dm-flakey device mapper target, so that it can do random > > corruption of read and write bios - I uploaded it here: > >

[dm-devel] [PATCH] Improve the dm-integrity documentation.

2023-05-30 Thread Russell Harmon
Documents the meaning of the "buffer", adds documentation of the current defaults, and provides an example of how the tunables relate to each other. Signed-off-by: Russell Harmon --- .../device-mapper/dm-integrity.rst| 44 --- 1 file changed, 27 insertions(+), 17

[dm-devel] [PATCH v2 01/16] device-mapper: Check that target specs are sufficiently aligned

2023-05-30 Thread Demi Marie Obenour
Otherwise subsequent code will dereference a misaligned `struct dm_target_spec *`, which is undefined behavior. Signed-off-by: Demi Marie Obenour Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: sta...@vger.kernel.org --- drivers/md/dm-ioctl.c | 7 +++ 1 file changed, 7 insertions(+) diff

[dm-devel] [PATCH v2 08/16] device-mapper: Allow userspace to provide expected diskseq

2023-05-30 Thread Demi Marie Obenour
This can be used to avoid race conditions in which a device is destroyed and recreated with the same major/minor, name, or UUID. diskseqs are only honored if strict parameter checking is on, to avoid any risk of breaking old userspace. Signed-off-by: Demi Marie Obenour ---

[dm-devel] [PATCH v2 13/16] xen-blkback: Implement diskseq checks

2023-05-30 Thread Demi Marie Obenour
This allows specifying a disk sequence number in XenStore. If it does not match the disk sequence number of the underlying device, the device will not be exported and a warning will be logged. Userspace can use this to eliminate race conditions due to major/minor number reuse. Old kernels do not

[dm-devel] [PATCH v2 16/16] xen-blkback: Inform userspace that device has been opened

2023-05-30 Thread Demi Marie Obenour
Set "opened" to "0" before the hotplug script is called. Once the device node has been opened, set "opened" to "1". "opened" is used exclusively by userspace. It serves two purposes: 1. It tells userspace that the diskseq Xenstore entry is supported. 2. It tells userspace that it can wait for

[dm-devel] [PATCH v2 03/16] device-mapper: do not allow targets to overlap 'struct dm_ioctl'

2023-05-30 Thread Demi Marie Obenour
This prevents dm_split_args() from corrupting this struct. Signed-off-by: Demi Marie Obenour Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: sta...@vger.kernel.org --- drivers/md/dm-ioctl.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c

Re: [dm-devel] [PATCH v6 13/20] md: check for failure when adding pages in alloc_behind_master_bio

2023-05-30 Thread Song Liu
On Tue, May 30, 2023 at 8:50 AM Johannes Thumshirn wrote: > > alloc_behind_master_bio() can possibly add multiple pages to a bio, but it > is not checking for the return value of bio_add_page() if adding really > succeeded. > > Check if the page adding succeeded and if not bail out. > >

[dm-devel] [PATCH v2 04/16] device-mapper: Better error message for too-short target spec

2023-05-30 Thread Demi Marie Obenour
Previously the error was "unable to find target", which is not helpful. Signed-off-by: Demi Marie Obenour --- drivers/md/dm-ioctl.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index

Re: [dm-devel] [PATCH v11 2/9] block: Add copy offload support infrastructure

2023-05-30 Thread Maurizio Lombardi
po 22. 5. 2023 v 13:17 odesílatel Nitesh Shetty napsal: > > +static int __blkdev_copy_offload(struct block_device *bdev_in, loff_t pos_in, > + struct block_device *bdev_out, loff_t pos_out, size_t len, > + cio_iodone_t endio, void *private, gfp_t gfp_mask) > +{ > +

[dm-devel] [PATCH v2 05/16] device-mapper: Target parameters must not overlap next target spec

2023-05-30 Thread Demi Marie Obenour
The NUL terminator for each target parameter string must preceed the following 'struct dm_target_spec'. Otherwise, dm_split_args() might corrupt this struct. Signed-off-by: Demi Marie Obenour Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: sta...@vger.kernel.org --- drivers/md/dm-ioctl.c | 32

Re: [dm-devel] [PATCH v11 2/9] block: Add copy offload support infrastructure

2023-05-30 Thread Nitesh Shetty
On 23/05/29 06:55PM, Matthew Wilcox wrote: On Mon, May 22, 2023 at 04:11:33PM +0530, Nitesh Shetty wrote: + token = alloc_page(gfp_mask); Why is PAGE_SIZE the right size for 'token'? That seems quite unlikely. I could understand it being SECTOR_SIZE or something that's

[dm-devel] [PATCH v2 00/16] Diskseq support in loop, device-mapper, and blkback

2023-05-30 Thread Demi Marie Obenour
This work aims to allow userspace to create and destroy block devices in a race-free way, and to allow them to be exposed to other Xen VMs via blkback without races. Changes since v1: - Several device-mapper fixes added. - The diskseq is now a separate Xenstore node, rather than being part of

[dm-devel] [PATCH v2 02/16] device-mapper: Avoid pointer arithmetic overflow

2023-05-30 Thread Demi Marie Obenour
Especially on 32-bit systems, it is possible for the pointer arithmetic to overflow and cause a userspace pointer to be dereferenced in the kernel. Signed-off-by: Demi Marie Obenour Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: sta...@vger.kernel.org --- drivers/md/dm-ioctl.c | 19

[dm-devel] [PATCH v2 06/16] device-mapper: Avoid double-fetch of version

2023-05-30 Thread Demi Marie Obenour
The version is fetched once in check_version(), which then does some validation and then overwrites the version in userspace with the API version supported by the kernel. copy_params() then fetches the version from userspace *again*, and this time no validation is done. The result is that the

Re: [dm-devel] [PATCH v11 2/9] block: Add copy offload support infrastructure

2023-05-30 Thread Nitesh Shetty
> > +/* > > + * @bdev_in: source block device > > + * @pos_in: source offset > > + * @bdev_out:destination block device > > + * @pos_out: destination offset > > + * @len: length in bytes to be copied > > + * @endio: endio function to be called on completion of copy operation, > > +

[dm-devel] [PATCH v2 15/16] xen-blkback: Minor cleanups

2023-05-30 Thread Demi Marie Obenour
This adds a couple of BUILD_BUG_ON()s and moves some arithmetic after the validation code that checks the arithmetic’s preconditions. The previous code was correct but could potentially trip sanitizers that check for unsigned integer wraparound. Signed-off-by: Demi Marie Obenour ---

Re: [dm-devel] fuzzing bcachefs with dm-flakey

2023-05-30 Thread Kent Overstreet
On Tue, May 30, 2023 at 09:12:44AM +1000, Dave Chinner wrote: > Perhaps it is worthwhile running the same tests on btrfs so we can > something to compare the bcachefs behaviour to. I suspect that btrfs > will fair little better on the single device, no checksums > corruption test It's also a

Re: [dm-devel] fuzzing bcachefs with dm-flakey

2023-05-30 Thread Kent Overstreet
On Mon, May 29, 2023 at 04:59:40PM -0400, Mikulas Patocka wrote: > Hi > > I improved the dm-flakey device mapper target, so that it can do random > corruption of read and write bios - I uploaded it here: > https://people.redhat.com/~mpatocka/testcases/bcachefs/dm-flakey.c > > I set up

[dm-devel] [PATCH v2 07/16] device-mapper: Allow userspace to opt-in to strict parameter checks

2023-05-30 Thread Demi Marie Obenour
Currently, device-mapper ioctls ignore unknown flags. This makes adding new flags to a given ioctl risky, as it could potentially break old userspace. To solve this problem, allow userspace to pass 5 as the major version to any ioctl. This causes the kernel to reject any flags that are not

[dm-devel] [PATCH v2 09/16] device-mapper: Allow userspace to suppress uevent generation

2023-05-30 Thread Demi Marie Obenour
Userspace can use this to avoid spamming udev with events that udev should ignore. Signed-off-by: Demi Marie Obenour --- drivers/md/dm-core.h | 2 + drivers/md/dm-ioctl.c | 78 ++- drivers/md/dm.c | 5 ++-

[dm-devel] [PATCH v2 10/16] device-mapper: Refuse to create device named "control"

2023-05-30 Thread Demi Marie Obenour
Typical userspace setups create a symlink under /dev/mapper with the name of the device, but /dev/mapper/control is reserved for the control device. Therefore, trying to create such a device is almost certain to be a userspace bug. Signed-off-by: Demi Marie Obenour --- drivers/md/dm-ioctl.c |

Re: [dm-devel] [PATCH v11 2/9] block: Add copy offload support infrastructure

2023-05-30 Thread Nitesh Shetty
On 23/05/30 01:29PM, Maurizio Lombardi wrote: po 22. 5. 2023 v 13:17 odesílatel Nitesh Shetty napsal: +static int __blkdev_copy_offload(struct block_device *bdev_in, loff_t pos_in, + struct block_device *bdev_out, loff_t pos_out, size_t len, + cio_iodone_t endio,

[dm-devel] [PATCH v2 12/16] device-mapper: inform caller about already-existing device

2023-05-30 Thread Demi Marie Obenour
Not only is this helpful for debugging, it also saves the caller an ioctl in the case where a device should be used if it exists or created otherwise. To ensure existing userspace is not broken, this feature is only enabled in strict mode. Signed-off-by: Demi Marie Obenour ---

[dm-devel] [PATCH v2 11/16] device-mapper: "." and ".." are not valid symlink names

2023-05-30 Thread Demi Marie Obenour
Using either of these is going to greatly confuse userspace, as they are not valid symlink names and so creating the usual /dev/mapper/NAME symlink will not be possible. As creating a device with either of these names is almost certainly a userspace bug, just error out. Signed-off-by: Demi Marie

Re: [dm-devel] [PATCH v5 04/20] fs: buffer: use __bio_add_page to add single page to bio

2023-05-30 Thread gouhao
> > The buffer_head submission code uses bio_add_page() to add a page to a > newly created bio. bio_add_page() can fail, but the return value is never > checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed to succeed. > > This brings us a step closer

[dm-devel] [PATCH v2 14/16] block, loop: Increment diskseq when releasing a loop device

2023-05-30 Thread Demi Marie Obenour
The previous patch for checking diskseq in blkback is not enough to prevent the following race: 1. Program X opens a loop device 2. Program X gets the diskseq of the loop device. 3. Program X associates a file with the loop device. 4. Program X passes the loop device major, minor, and diskseq to

Re: [dm-devel] [PATCH v7 12/12] crypto: x86/aes-kl - Implement the AES-XTS algorithm

2023-05-30 Thread Chang S. Bae
On 5/26/2023 12:23 AM, Eric Biggers wrote: On Wed, May 24, 2023 at 09:57:17AM -0700, Chang S. Bae wrote: == API Limitation == The setkey() function transforms an AES key into a handle. But, an extended key is a usual outcome of setkey() in other AES cipher implementations. For this reason, a

Re: [dm-devel] [PATCH v7 10/12] crypto: x86/aesni - Use the proper data type in struct aesni_xts_ctx

2023-05-30 Thread Chang S. Bae
On 5/25/2023 11:54 PM, Eric Biggers wrote: On Wed, May 24, 2023 at 09:57:15AM -0700, Chang S. Bae wrote: +static inline unsigned long aes_align_addr(unsigned long addr) +{ + return (crypto_tfm_ctx_alignment() >= AESNI_ALIGN) ? + ALIGN(addr, 1) : ALIGN(addr, AESNI_ALIGN); +}

Re: [dm-devel] [PATCH v5 16/20] dm-crypt: check if adding pages to clone bio fails

2023-05-30 Thread Mikulas Patocka
On Tue, 30 May 2023, Mike Snitzer wrote: > On Tue, May 30 2023 at 11:13P -0400, > Mikulas Patocka wrote: > > > Hi > > > > I nack this. This just adds code that can't ever be executed. > > > > dm-crypt already allocates enough entries in the vector (see "unsigned int > > nr_iovecs = (size

Re: [dm-devel] [PATCH v6 16/20] dm-crypt: check if adding pages to clone bio fails

2023-05-30 Thread Johannes Thumshirn
On 30.05.23 18:10, Mike Snitzer wrote: > On Tue, May 30 2023 at 11:49P -0400, > Johannes Thumshirn wrote: > >> Check if adding pages to clone bio fails and if it does retry with >> reclaim. This mirrors the behaviour of page allocation in >> crypt_alloc_buffer(). > > Nope. > >> This way we can

Re: [dm-devel] [PATCH v6 16/20] dm-crypt: check if adding pages to clone bio fails

2023-05-30 Thread Mike Snitzer
On Tue, May 30 2023 at 11:49P -0400, Johannes Thumshirn wrote: > Check if adding pages to clone bio fails and if it does retry with > reclaim. This mirrors the behaviour of page allocation in > crypt_alloc_buffer(). Nope. > This way we can mark bio_add_pages as __must_check. > > Reviewed-by:

Re: [dm-devel] [PATCH v6 20/20] block: mark bio_add_folio as __must_check

2023-05-30 Thread Matthew Wilcox
On Tue, May 30, 2023 at 08:49:23AM -0700, Johannes Thumshirn wrote: > Now that all callers of bio_add_folio() check the return value, mark it as > __must_check. > > Signed-off-by: Johannes Thumshirn Reviewed-by: Matthew Wilcox (Oracle) -- dm-devel mailing list dm-devel@redhat.com

Re: [dm-devel] [PATCH v6 19/20] fs: iomap: use __bio_add_folio where possible

2023-05-30 Thread Matthew Wilcox
On Tue, May 30, 2023 at 08:49:22AM -0700, Johannes Thumshirn wrote: > When the iomap buffered-io code can't add a folio to a bio, it allocates a > new bio and adds the folio to that one. This is done using bio_add_folio(), > but doesn't check for errors. > > As adding a folio to a newly created

Re: [dm-devel] [PATCH v6 18/20] block: add __bio_add_folio

2023-05-30 Thread Matthew Wilcox
On Tue, May 30, 2023 at 08:49:21AM -0700, Johannes Thumshirn wrote: > Just like for bio_add_pages() add a no-fail variant for bio_add_folio(). > > Signed-off-by: Johannes Thumshirn Reviewed-by: Matthew Wilcox (Oracle) -- dm-devel mailing list dm-devel@redhat.com

[dm-devel] [PATCH v6 18/20] block: add __bio_add_folio

2023-05-30 Thread Johannes Thumshirn
Just like for bio_add_pages() add a no-fail variant for bio_add_folio(). Signed-off-by: Johannes Thumshirn --- block/bio.c | 8 include/linux/bio.h | 1 + 2 files changed, 9 insertions(+) diff --git a/block/bio.c b/block/bio.c index 043944fd46eb..350c653d4a57 100644 ---

[dm-devel] [PATCH v6 15/20] md: raid1: check if adding pages to resync bio fails

2023-05-30 Thread Johannes Thumshirn
Check if adding pages to resync bio fails and if bail out. As the comment above suggests this cannot happen, WARN if it actually happens. This way we can mark bio_add_pages as __must_check. Reviewed-by: Damien Le Moal Acked-by: Song Liu Signed-off-by: Johannes Thumshirn ---

[dm-devel] [PATCH v6 19/20] fs: iomap: use __bio_add_folio where possible

2023-05-30 Thread Johannes Thumshirn
When the iomap buffered-io code can't add a folio to a bio, it allocates a new bio and adds the folio to that one. This is done using bio_add_folio(), but doesn't check for errors. As adding a folio to a newly created bio can't fail, use the newly introduced __bio_add_folio() function.

[dm-devel] [PATCH v6 17/20] block: mark bio_add_page as __must_check

2023-05-30 Thread Johannes Thumshirn
Now that all users of bio_add_page check for the return value, mark bio_add_page as __must_check. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h

[dm-devel] [PATCH v6 20/20] block: mark bio_add_folio as __must_check

2023-05-30 Thread Johannes Thumshirn
Now that all callers of bio_add_folio() check the return value, mark it as __must_check. Signed-off-by: Johannes Thumshirn --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index 4232a17e6b10..fef9f3085a02

[dm-devel] [PATCH v6 14/20] md: raid1: use __bio_add_page for adding single page to bio

2023-05-30 Thread Johannes Thumshirn
The sync request code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as

[dm-devel] [PATCH v6 08/20] jfs: logmgr: use __bio_add_page to add single page to bio

2023-05-30 Thread Johannes Thumshirn
The JFS IO code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as

[dm-devel] [PATCH v6 16/20] dm-crypt: check if adding pages to clone bio fails

2023-05-30 Thread Johannes Thumshirn
Check if adding pages to clone bio fails and if it does retry with reclaim. This mirrors the behaviour of page allocation in crypt_alloc_buffer(). This way we can mark bio_add_pages as __must_check. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- drivers/md/dm-crypt.c | 5

[dm-devel] [PATCH v6 07/20] md: raid5: use __bio_add_page to add single page to new bio

2023-05-30 Thread Johannes Thumshirn
The raid5-ppl submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. For adding consecutive pages, the return is actually checked and a new bio is allocated if adding the page fails. Use __bio_add_page() as adding

[dm-devel] [PATCH v6 13/20] md: check for failure when adding pages in alloc_behind_master_bio

2023-05-30 Thread Johannes Thumshirn
alloc_behind_master_bio() can possibly add multiple pages to a bio, but it is not checking for the return value of bio_add_page() if adding really succeeded. Check if the page adding succeeded and if not bail out. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn ---

[dm-devel] [PATCH v6 12/20] floppy: use __bio_add_page for adding single page to bio

2023-05-30 Thread Johannes Thumshirn
The floppy code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as

[dm-devel] [PATCH v6 11/20] zram: use __bio_add_page for adding single page to bio

2023-05-30 Thread Johannes Thumshirn
The zram writeback code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page()

[dm-devel] [PATCH v6 10/20] zonefs: use __bio_add_page for adding single page to bio

2023-05-30 Thread Johannes Thumshirn
The zonefs superblock reading code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[dm-devel] [PATCH v6 05/20] md: use __bio_add_page to add single page

2023-05-30 Thread Johannes Thumshirn
The md-raid superblock writing code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[dm-devel] [PATCH v6 09/20] gfs2: use __bio_add_page for adding single page to bio

2023-05-30 Thread Johannes Thumshirn
The GFS2 superblock reading code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[dm-devel] [PATCH v6 03/20] dm: dm-zoned: use __bio_add_page for adding single metadata page

2023-05-30 Thread Johannes Thumshirn
dm-zoned uses bio_add_page() for adding a single page to a freshly created metadata bio. Use __bio_add_page() instead as adding a single page to a new bio is always guaranteed to succeed. This brings us a step closer to marking bio_add_page() __must_check Reviewed-by: Damien Le Moal

[dm-devel] [PATCH v6 02/20] drbd: use __bio_add_page to add page to bio

2023-05-30 Thread Johannes Thumshirn
The drbd code only adds a single page to a newly created bio. So use __bio_add_page() to add the page which is guaranteed to succeed in this case. This brings us closer to marking bio_add_page() as __must_check. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn ---

[dm-devel] [PATCH v6 06/20] md: raid5-log: use __bio_add_page to add single page

2023-05-30 Thread Johannes Thumshirn
The raid5 log metadata submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

[dm-devel] [PATCH v6 04/20] fs: buffer: use __bio_add_page to add single page to bio

2023-05-30 Thread Johannes Thumshirn
The buffer_head submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking

Re: [dm-devel] [PATCH v5 16/20] dm-crypt: check if adding pages to clone bio fails

2023-05-30 Thread Mike Snitzer
On Tue, May 30 2023 at 11:13P -0400, Mikulas Patocka wrote: > > > On Tue, 2 May 2023, Johannes Thumshirn wrote: > > > Check if adding pages to clone bio fails and if it does retry with > > reclaim. This mirrors the behaviour of page allocation in > > crypt_alloc_buffer(). > > > > This way we

[dm-devel] [PATCH v6 00/20] bio: check return values of bio_add_page

2023-05-30 Thread Johannes Thumshirn
We have two functions for adding a page to a bio, __bio_add_page() which is used to add a single page to a freshly created bio and bio_add_page() which is used to add a page to an existing bio. While __bio_add_page() is expected to succeed, bio_add_page() can fail. This series converts the

[dm-devel] [PATCH v6 01/20] swap: use __bio_add_page to add page to bio

2023-05-30 Thread Johannes Thumshirn
The swap code only adds a single page to a newly created bio. So use __bio_add_page() to add the page which is guaranteed to succeed in this case. This brings us closer to marking bio_add_page() as __must_check. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- mm/page_io.c |

Re: [dm-devel] [PATCH v7 0/5] Introduce provisioning primitives

2023-05-30 Thread Mike Snitzer
On Tue, May 30 2023 at 10:55P -0400, Joe Thornber wrote: > On Tue, May 30, 2023 at 3:02 PM Mike Snitzer wrote: > > > > > Also Joe, for you proposed dm-thinp design where you distinquish > > between "provision" and "reserve": Would it make sense for REQ_META > > (e.g. all XFS metadata) with

Re: [dm-devel] [PATCH v5 00/20] bio: check return values of bio_add_page

2023-05-30 Thread Jens Axboe
On 5/26/23 12:37 AM, Johannes Thumshirn wrote: > On 24.05.23 17:02, Jens Axboe wrote: >> On 5/2/23 4:19?AM, Johannes Thumshirn wrote: >>> We have two functions for adding a page to a bio, __bio_add_page() which is >>> used to add a single page to a freshly created bio and bio_add_page() which >>>

Re: [dm-devel] [PATCH v5 16/20] dm-crypt: check if adding pages to clone bio fails

2023-05-30 Thread Mikulas Patocka
On Tue, 2 May 2023, Johannes Thumshirn wrote: > Check if adding pages to clone bio fails and if it does retry with > reclaim. This mirrors the behaviour of page allocation in > crypt_alloc_buffer(). > > This way we can mark bio_add_pages as __must_check. > > Reviewed-by: Damien Le Moal >

Re: [dm-devel] [PATCH v7 0/5] Introduce provisioning primitives

2023-05-30 Thread Joe Thornber
On Tue, May 30, 2023 at 3:02 PM Mike Snitzer wrote: > > Also Joe, for you proposed dm-thinp design where you distinquish > between "provision" and "reserve": Would it make sense for REQ_META > (e.g. all XFS metadata) with REQ_PROVISION to be treated as an > LBA-specific hard request? Whereas

Re: [dm-devel] [PATCH v7 0/5] Introduce provisioning primitives

2023-05-30 Thread Mike Snitzer
On Tue, May 30 2023 at 3:27P -0400, Joe Thornber wrote: > On Sat, May 27, 2023 at 12:45 AM Dave Chinner wrote: > > > On Fri, May 26, 2023 at 12:04:02PM +0100, Joe Thornber wrote: > > > > > 1) We have an api (ioctl, bio flag, whatever) that lets you > > > reserve/guarantee a region: > > > > >

Re: [dm-devel] fuzzing bcachefs with dm-flakey

2023-05-30 Thread Mikulas Patocka
On Mon, 29 May 2023, Matthew Wilcox wrote: > On Mon, May 29, 2023 at 04:59:40PM -0400, Mikulas Patocka wrote: > > Hi > > > > I improved the dm-flakey device mapper target, so that it can do random > > corruption of read and write bios - I uploaded it here: > >

[dm-devel] [PATCH] bcachefs: fix NULL pointer dereference in try_alloc_bucket

2023-05-30 Thread Mikulas Patocka
On Mon, 29 May 2023, Mikulas Patocka wrote: > The oops happens in set_btree_iter_dontneed and it is caused by the fact > that iter->path is NULL. The code in try_alloc_bucket is buggy because it > sets "struct btree_iter iter = { NULL };" and then jumps to the "err" > label that tries to

Re: [dm-devel] [PATCH v7 0/5] Introduce provisioning primitives

2023-05-30 Thread Joe Thornber
On Sat, May 27, 2023 at 12:45 AM Dave Chinner wrote: > On Fri, May 26, 2023 at 12:04:02PM +0100, Joe Thornber wrote: > > > 1) We have an api (ioctl, bio flag, whatever) that lets you > > reserve/guarantee a region: > > > > int reserve_region(dev, sector_t begin, sector_t end); > > A C-based