Re: [dm-devel] [PATCH v8 4/9] fs, block: copy_file_range for def_blk_ops for direct block device.

2023-03-29 Thread Christian Brauner
On Mon, Mar 27, 2023 at 02:10:52PM +0530, Anuj Gupta wrote: > From: Nitesh Shetty > > For direct block device opened with O_DIRECT, use copy_file_range to > issue device copy offload, and fallback to generic_copy_file_range incase > device copy offload capability is absent. > Modify checks to all

Re: [dm-devel] [PATCH v8 4/9] fs, block: copy_file_range for def_blk_ops for direct block device.

2023-03-29 Thread Christian Brauner
On Wed, Mar 29, 2023 at 06:12:36PM +0530, Nitesh Shetty wrote: > On Wed, Mar 29, 2023 at 02:14:40PM +0200, Christian Brauner wrote: > > On Mon, Mar 27, 2023 at 02:10:52PM +0530, Anuj Gupta wrote: > > > From: Nitesh Shetty > > > > > > For direct bl

Re: [dm-devel] decouple block open flags from fmode_t

2023-06-06 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:19AM +0200, Christoph Hellwig wrote: > Hi all, > > this series adds a new blk_mode_t for block open flags instead of abusing Trying to look at this series applied but doesn't apply cleanly for anything v6.4-rc* related. What tree is this on? -- dm-devel mailing list

Re: [dm-devel] [PATCH 17/31] block: add a sb_open_mode helper

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:36AM +0200, Christoph Hellwig wrote: > Add a helper to return the open flags for blkdev_get_by* for passed in > super block flags instead of open coding the logic in many places. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acke

Re: [dm-devel] [PATCH 02/31] cdrom: remove the unused bdev argument to cdrom_open

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:21AM +0200, Christoph Hellwig wrote: > Signed-off-by: Christoph Hellwig > --- lgtm, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 21/31] scsi: replace the fmode_t argument to ->sg_io_fn with a simple bool

2023-06-07 Thread Christian Brauner
good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 20/31] scsi: replace the fmode_t argument to scsi_ioctl with a simple bool

2023-06-07 Thread Christian Brauner
good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 18/31] fs: remove sb->s_mode

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:37AM +0200, Christoph Hellwig wrote: > There is no real need to store the open mode in the super_block now. > It is only used by f2fs, which can easily recalculate it. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian

Re: [dm-devel] [PATCH 11/31] block: rename blkdev_close to blkdev_release

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:30AM +0200, Christoph Hellwig wrote: > Make the function name match the method name. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mail

Re: [dm-devel] [PATCH 09/31] block: pass a gendisk to ->open

2023-06-07 Thread Christian Brauner
t; void (*release) (struct gendisk *, fmode_t); > int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); > int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned > long); Looks good to me, Acked-by: Christian Brauner (I didn't bother go

Re: [dm-devel] [PATCH 07/31] block: pass a gendisk on bdev_check_media_change

2023-06-07 Thread Christian Brauner
gt; --- Under the assumption it did only in fact ever only get called on the whole device so far, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] decouple block open flags from fmode_t

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 10:40:42AM +0200, Christoph Hellwig wrote: > On Tue, Jun 06, 2023 at 10:27:14AM +0200, Christian Brauner wrote: > > On Tue, Jun 06, 2023 at 09:39:19AM +0200, Christoph Hellwig wrote: > > > Hi all, > > > > > > this series adds a new blk

Re: [dm-devel] [PATCH 15/31] btrfs: don't pass a holder for non-exclusive blkdev_get_by_path

2023-06-07 Thread Christian Brauner
v_get_by_path calls. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 31/31] fs: remove the now unused FMODE_* flags

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:50AM +0200, Christoph Hellwig wrote: > FMODE_NDELAY, FMODE_EXCL and FMODE_WRITE_IOCTL were only used for > block internal purposed and are now entirely unused, so remove them. > > Signed-off-by: Christoph Hellwig > --- Love it, Reviewed-by: Ch

Re: [dm-devel] [PATCH 26/31] block: move a few internal definitions out of blkdev.h

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:45AM +0200, Christoph Hellwig wrote: > All these helpers are only used in core block code, so move them out of > the public header. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailin

Re: [dm-devel] [PATCH 08/31] block: share code between disk_check_media_change and disk_force_media_change

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:27AM +0200, Christoph Hellwig wrote: > Factor the common logic between disk_check_media_change and > disk_force_media_change into a helper. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailin

Re: [dm-devel] [PATCH 25/31] ubd: remove commented out code in ubd_open

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:44AM +0200, Christoph Hellwig wrote: > This code has been dead forever, make sure it doesn't show up in code > searches. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-de

Re: [dm-devel] [PATCH 28/31] block: replace fmode_t with a block-specific type for block open flags

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:47AM +0200, Christoph Hellwig wrote: > The only overlap between the block open flags mapped into the fmode_t and > other uses of fmode_t are FMODE_READ and FMODE_WRITE. Define a new and FMODE_EXCL afaict > blk_mode_t instead for use in blkdev_get_by_*, ->open and ->

Re: [dm-devel] [PATCH 16/31] block: use the holder as indication for exclusive opens

2023-06-07 Thread Christian Brauner
> > For blkdev_put this requires adding the holder argument, which provides > better debug checking that only the holder actually releases the hold, > but at the same time allows removing the now superfluous mode argument. > > Signed-off-by: Christoph Hellwig > --- Looks g

Re: [dm-devel] [PATCH 06/31] cdrom: remove the unused mode argument to cdrom_release

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:25AM +0200, Christoph Hellwig wrote: > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 01/31] block: also call ->open for incremental partition opens

2023-06-07 Thread Christian Brauner
> for ioctl only or NDELAY opens. > > Signed-off-by: Christoph Hellwig > --- This assumes that all drivers deal with additional ->open() calls for each partition correctly which I assumed you checked so, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com

Re: [dm-devel] [PATCH 30/31] block: store the holder in file->private_data

2023-06-07 Thread Christian Brauner
> --- Feels a bit odd to store the object itself but anyway, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 10/31] block: remove the unused mode argument to ->release

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:29AM +0200, Christoph Hellwig wrote: > The mode argument to the ->release block_device_operation is never used, > so remove it. > > Signed-off-by: Christoph Hellwig > --- Good cleanup. Looks good to me, Acked-by: Christian Brauner -- dm-dev

Re: [dm-devel] [PATCH 19/31] scsi: replace the fmode_t argument to scsi_cmd_allowed with a simple bool

2023-06-07 Thread Christian Brauner
good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 29/31] block: always use I_BDEV on file->f_mapping->host to find the bdev

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:48AM +0200, Christoph Hellwig wrote: > Always use I_BDEV(file->f_mapping->host) to find the bdev for a file to > free up file->private_data for other uses. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christi

Re: [dm-devel] [PATCH 28/31] block: replace fmode_t with a block-specific type for block open flags

2023-06-07 Thread Christian Brauner
On Wed, Jun 07, 2023 at 11:21:24AM +0200, Christian Brauner wrote: > On Tue, Jun 06, 2023 at 09:39:47AM +0200, Christoph Hellwig wrote: > > The only overlap between the block open flags mapped into the fmode_t and > > other uses of fmode_t are FMODE_READ and FMODE_WRITE. Define

Re: [dm-devel] [PATCH 14/31] rnbd-srv: don't pass a holder for non-exclusive blkdev_get_by_path

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:33AM +0200, Christoph Hellwig wrote: > Passing a holder to blkdev_get_by_path when FMODE_EXCL isn't set doesn't > make sense, so pass NULL instead. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner

Re: [dm-devel] [PATCH 03/31] cdrom: remove the unused mode argument to cdrom_ioctl

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:22AM +0200, Christoph Hellwig wrote: > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 24/31] rnbd-srv: replace sess->open_flags with a "bool readonly"

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:43AM +0200, Christoph Hellwig wrote: > Stop passing the fmode_t around and just use a simple bool to track if > an export is read-only. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailin

Re: [dm-devel] [PATCH 23/31] mtd: block: use a simple bool to track open for write

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:42AM +0200, Christoph Hellwig wrote: > Instead of propagating the fmode_t, just use a bool to track if a mtd > block device was opened for writing. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-dev

Re: [dm-devel] [PATCH 04/31] cdrom: remove the unused cdrom_close_write release code

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:23AM +0200, Christoph Hellwig wrote: > cdrom_close_write is empty, and the for_data flag it is keyed off is > never set. Remove all this clutter. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel

Re: [dm-devel] [PATCH 22/31] nvme: replace the fmode_t argument to the nvme ioctl handlers with a simple bool

2023-06-07 Thread Christian Brauner
good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 27/31] block: remove unused fmode_t arguments from ioctl handlers

2023-06-07 Thread Christian Brauner
On Tue, Jun 06, 2023 at 09:39:46AM +0200, Christoph Hellwig wrote: > A few ioctl handlers have fmode_t arguments that are entirely unused, > remove them. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@r

Re: [dm-devel] [PATCH 05/31] cdrom: track if a cdrom_device_info was opened for data

2023-06-07 Thread Christian Brauner
gt; nothing but the CDROM drivers uses that argument. > > Signed-off-by: Christoph Hellwig > --- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 27/30] block: replace fmode_t with a block-specific type for block open flags

2023-06-09 Thread Christian Brauner
off_t lend); > +blk_mode_t file_to_blk_mode(struct file *file); > +int truncate_bdev_range(struct block_device *bdev, blk_mode_t mode, > + loff_t lstart, loff_t lend); > long blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg); > long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg); > > diff --git a/block/fops.c b/block/fops.c > index 9f26e25bafa172..086612103b9dd9 100644 > --- a/block/fops.c > +++ b/block/fops.c > @@ -470,6 +470,30 @@ static int blkdev_fsync(struct file *filp, loff_t start, > loff_t end, > return error; > } > > +blk_mode_t file_to_blk_mode(struct file *file) > +{ > + blk_mode_t mode = 0; > + > + if (file->f_mode & FMODE_READ) > + mode |= BLK_OPEN_READ; > + if (file->f_mode & FMODE_WRITE) > + mode |= BLK_OPEN_WRITE; > + if (file->f_mode & FMODE_EXCL) > + mode |= BLK_OPEN_EXCL; > + if (file->f_flags & O_NDELAY) > + mode |= BLK_OPEN_NDELAY; > + > + /* > + * If all bits in O_ACCMODE set (aka O_RDWR | O_WRONLY), the floppy > + * driver has historically allowed ioctls as if the file was opened for > + * writing, but does not allow and actual reads or writes. > + */ > + if ((file->f_flags & O_ACCMODE) == (O_RDWR | O_WRONLY)) > + mode |= BLK_OPEN_WRITE_IOCTL; Thanks for that! Reviewed-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 10/29] dm: Convert to bdev_open_by_dev()

2023-08-27 Thread Christian Brauner
-- Looks good to me, Acked-by: Christian Brauner -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v3 0/29] block: Make blkdev_get_by_*() return handle

2023-08-27 Thread Christian Brauner
On Wed, Aug 23, 2023 at 12:48:11PM +0200, Jan Kara wrote: > Hello, > > this is a v3 of the patch series which implements the idea of > blkdev_get_by_*() > calls returning bdev_handle which is then passed to blkdev_put() [1]. This > makes the get and put calls for bdevs more obviously matching and

Re: [dm-devel] [PATCH v2 0/29] block: Make blkdev_get_by_*() return handle

2023-08-28 Thread Christian Brauner
> So besides my last fput() worry about I think this could work and would be > probably a bit nicer than what I have. But before going and redoing the whole > series let me gather some more feedback so that we don't go back and forth. > Christoph, Christian, Jens, any opinion? I'll be a bit under

Re: [dm-devel] [PATCH v3 0/29] block: Make blkdev_get_by_*() return handle

2023-08-29 Thread Christian Brauner
> replacement) I think we can go ahead with the series as is. As you said > there will be some conflicts in btrfs and I've learned about f2fs conflicts > as well so I can rebase & repost the series on top of rc1 to make life > easier for you. That is be much appreciated. Thank you! -- dm-devel ma

Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount

2023-09-06 Thread Christian Brauner
On Wed, Sep 06, 2023 at 06:01:06PM +0200, Mikulas Patocka wrote: > > > On Wed, 6 Sep 2023, Christian Brauner wrote: > > > > > IOW, you'd also hang on any umount of a bind-mount. IOW, every > > > > single container making use of this filesystems via bin

Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount

2023-09-06 Thread Christian Brauner
> Currently, if we freeze a filesystem with "fsfreeze" and unmount it, the > mount point is removed, but the filesystem stays active and it is leaked. > You can't unfreeze it with "fsfreeze --unfreeze" because the mount point > is gone. (the only way how to recover it is "echo j>/proc/sysrq-trig

Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount

2023-09-06 Thread Christian Brauner
On Wed, Sep 06, 2023 at 08:22:45AM -0700, Darrick J. Wong wrote: > On Wed, Sep 06, 2023 at 03:26:21PM +0200, Mikulas Patocka wrote: > > lvm may suspend any logical volume anytime. If lvm suspend races with > > unmount, it may be possible that the kernel writes to the filesystem after > > unmount su

Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount

2023-09-06 Thread Christian Brauner
On Wed, Sep 06, 2023 at 03:26:21PM +0200, Mikulas Patocka wrote: > lvm may suspend any logical volume anytime. If lvm suspend races with > unmount, it may be possible that the kernel writes to the filesystem after > unmount successfully returned. The problem can be demonstrated with this > script:

Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount

2023-09-06 Thread Christian Brauner
On Wed, Sep 06, 2023 at 05:33:32PM +0200, Christian Brauner wrote: > > Currently, if we freeze a filesystem with "fsfreeze" and unmount it, the > > mount point is removed, but the filesystem stays active and it is leaked. > > You can't unfreeze it with "

Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount

2023-09-08 Thread Christian Brauner
> I think we've got too deep down into "how to fix things" but I'm not 100% We did. > sure what the "bug" actually is. In the initial posting Mikulas writes "the > kernel writes to the filesystem after unmount successfully returned" - is > that really such a big issue? Anybody else can open the d

Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount

2023-09-08 Thread Christian Brauner
> Well, currently you click some "Eject / safely remove / whatever" button > and then you get a "wait" dialog until everything is done after which > you're told the stick is safe to remove. What I imagine is that the "wait" > dialog needs to be there while there are any (or exclusive at minimum) op

Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount

2023-09-08 Thread Christian Brauner
> So can you please elaborate which new risks are we going to introduce by > fixing this resource hole ? I'm not quite sure why you need a personal summary of the various reasons different people brought together in the thread. -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.c

Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount

2023-09-08 Thread Christian Brauner
> I'd say there are several options and we should aim towards the variant > which is most usable by normal users. None of the options is sufficiently satisfying to risk intricate behavioral changes with unknown consequences for existing workloads as far as I'm concerned. -- dm-devel mailing list

Re: [dm-devel] [PATCH v4 0/29] block: Make blkdev_get_by_*() return handle

2023-09-27 Thread Christian Brauner
On Wed, 27 Sep 2023 11:34:07 +0200, Jan Kara wrote: > Create struct bdev_handle that contains all parameters that need to be > passed to blkdev_put() and provide bdev_open_* functions that return > this structure instead of plain bdev pointer. This will eventually allow > us to pass one more argume