Re: [dm-devel] [PATCH v6 0/8] IMA: support for measuring kernel integrity critical data

2020-11-24 Thread Mimi Zohar
Hi Pavel, On Sun, 2020-11-22 at 22:00 +0100, Pavel Machek wrote: > Hi! > > > >How is it supposed to be useful? > > > > > >I'm pretty sure there are critical data that are not measured by > > >proposed module... and that are written under normal circumstances. > > > > > The goal of this series is

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Miguel Ojeda
On Sun, Nov 22, 2020 at 11:54 PM Finn Thain wrote: > > We should also take into account optimisim about future improvements in > tooling. Not sure what you mean here. There is no reliable way to guess what the intention was with a missing fallthrough, even if you parsed whitespace and indentation

Re: [dm-devel] [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Gustavo A. R. Silva
On Sun, Nov 22, 2020 at 11:53:55AM -0800, James Bottomley wrote: > On Sun, 2020-11-22 at 11:22 -0800, Joe Perches wrote: > > On Sun, 2020-11-22 at 11:12 -0800, James Bottomley wrote: > > > On Sun, 2020-11-22 at 10:25 -0800, Joe Perches wrote: > > > > On Sun, 2020-11-22 at 10:21 -0800, James Bottoml

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread James Bottomley
On Mon, 2020-11-23 at 15:19 +0100, Miguel Ojeda wrote: > On Sun, Nov 22, 2020 at 11:36 PM James Bottomley > wrote: > > Well, it seems to be three years of someone's time plus the > > maintainer review time and series disruption of nearly a thousand > > patches. Let's be conservative and assume th

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Miguel Ojeda
On Sun, Nov 22, 2020 at 11:36 PM James Bottomley wrote: > > Well, it seems to be three years of someone's time plus the maintainer > review time and series disruption of nearly a thousand patches. Let's > be conservative and assume the producer worked about 30% on the series > and it takes about

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Joe Perches
On Mon, 2020-11-23 at 07:58 -0800, James Bottomley wrote: > We're also complaining about the inability to recruit maintainers: > > https://www.theregister.com/2020/06/30/hard_to_find_linux_maintainers_says_torvalds/ > > And burn out: > > http://antirez.com/news/129 https://www.wired.com/story/o

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Miguel Ojeda
On Mon, Nov 23, 2020 at 4:58 PM James Bottomley wrote: > > Well, I used git. It says that as of today in Linus' tree we have 889 > patches related to fall throughs and the first series went in in > october 2017 ... ignoring a couple of outliers back to February. I can see ~10k insertions over ~1

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Finn Thain
On Mon, 23 Nov 2020, Miguel Ojeda wrote: > On Mon, 23 Nov 2020, Finn Thain wrote: > > > On Sun, 22 Nov 2020, Miguel Ojeda wrote: > > > > > > > > It isn't that much effort, isn't it? Plus we need to take into > > > account the future mistakes that it might prevent, too. > > > > We should als

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Rafael J. Wysocki
On Mon, Nov 23, 2020 at 4:58 PM James Bottomley wrote: > > On Mon, 2020-11-23 at 15:19 +0100, Miguel Ojeda wrote: > > On Sun, Nov 22, 2020 at 11:36 PM James Bottomley > > wrote: [cut] > > > > Maintainers routinely review 1-line trivial patches, not to mention > > internal API changes, etc. > >

Re: [dm-devel] [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread James Bottomley
On Mon, 2020-11-23 at 07:03 -0600, Gustavo A. R. Silva wrote: > On Sun, Nov 22, 2020 at 11:53:55AM -0800, James Bottomley wrote: > > On Sun, 2020-11-22 at 11:22 -0800, Joe Perches wrote: > > > On Sun, 2020-11-22 at 11:12 -0800, James Bottomley wrote: > > > > On Sun, 2020-11-22 at 10:25 -0800, Joe P

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Jakub Kicinski
On Mon, 23 Nov 2020 17:32:51 -0800 Nick Desaulniers wrote: > On Sun, Nov 22, 2020 at 8:17 AM Kees Cook wrote: > > On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > > > If none of the 140 patches here fix a real bug, and there is no change > > > to machine code then it sounds to m

Re: [dm-devel] [PATCH v6 8/8] selinux: measure state and hash of the policy using IMA

2020-11-24 Thread Tushar Sugandhi
Hi James, On 2020-11-20 6:05 p.m., James Morris wrote: On Thu, 19 Nov 2020, Tushar Sugandhi wrote: an impact on the security guarantees provided by SELinux. Measuring such in-memory data structures through IMA subsystem provides a secure way for a remote attestation service to know the state o

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread James Bottomley
On Mon, 2020-11-23 at 19:56 +0100, Miguel Ojeda wrote: > On Mon, Nov 23, 2020 at 4:58 PM James Bottomley > wrote: > > Well, I used git. It says that as of today in Linus' tree we have > > 889 patches related to fall throughs and the first series went in > > in october 2017 ... ignoring a couple o

Re: [dm-devel] [PATCH v6 0/8] IMA: support for measuring kernel integrity critical data

2020-11-24 Thread Mimi Zohar
On Mon, 2020-11-23 at 18:18 +0100, Pavel Machek wrote: > > > Basically every other data structure in kernel is "critical" by your > > > definition, and you can't really measure them all; some of them change > > > rather often. Going piecemeal does not really help here. > > > > Agreed, measuring da

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Jason Gunthorpe
On Fri, Nov 20, 2020 at 12:21:39PM -0600, Gustavo A. R. Silva wrote: > IB/hfi1: Fix fall-through warnings for Clang > IB/mlx4: Fix fall-through warnings for Clang > IB/qedr: Fix fall-through warnings for Clang > RDMA/mlx5: Fix fall-through warnings for Clang I picked these four to the rdm

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Joe Perches
On Tue, 2020-11-24 at 11:58 +1100, Finn Thain wrote: > it's not for me to prove that such patches don't affect code > generation. That's for the patch author and (unfortunately) for reviewers. Ideally, that proof would be provided by the compilation system itself and not patch authors nor reviewe

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Finn Thain
On Mon, 23 Nov 2020, Joe Perches wrote: > On Tue, 2020-11-24 at 11:58 +1100, Finn Thain wrote: > > it's not for me to prove that such patches don't affect code > > generation. That's for the patch author and (unfortunately) for > > reviewers. > > Ideally, that proof would be provided by the c

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Mark Brown
On Fri, 20 Nov 2020 12:21:39 -0600, Gustavo A. R. Silva wrote: > This series aims to fix almost all remaining fall-through warnings in > order to enable -Wimplicit-fallthrough for Clang. > > In preparation to enable -Wimplicit-fallthrough for Clang, explicitly > add multiple break/goto/return/fall

Re: [dm-devel] [PATCH 01/20] blk-cgroup: fix a hd_struct leak in blkcg_fill_root_iostats

2020-11-24 Thread Tejun Heo
On Wed, Nov 18, 2020 at 09:47:41AM +0100, Christoph Hellwig wrote: > disk_get_part needs to be paired with a disk_put_part. > > Fixes: ef45fe470e1 ("blk-cgroup: show global disk stats in root cgroup > io.stat") > Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo Thanks. -- tejun -- dm-d

[dm-devel] [PATCH 35/45] block: move make_it_fail to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the make_it_fail flag to struct block_device an turn it into a bool in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 3 ++- block/genhd.c | 4 ++-- include/linux/blk_types.h | 3 +++ include/linux/genhd.h | 3 --- 4

[dm-devel] [PATCH 42/45] block: switch disk_part_iter_* to use a struct block_device

2020-11-24 Thread Christoph Hellwig
Switch the partition iter infrastructure to iterate over block_device references instead of hd_struct ones mostly used to get at the block_device. Signed-off-by: Christoph Hellwig --- block/genhd.c | 57 +++ block/partitions/core.c | 13 +

[dm-devel] [PATCH 39/45] block: remove the partno field from struct hd_struct

2020-11-24 Thread Christoph Hellwig
Just use the bd_partno field in struct block_device everywhere. Signed-off-by: Christoph Hellwig --- block/genhd.c | 12 ++-- block/partitions/core.c | 9 - include/linux/genhd.h | 1 - init/do_mounts.c| 2 +- 4 files changed, 11 insertions(+), 13 deletions

[dm-devel] [PATCH 43/45] f2fs: remove a few bd_part checks

2020-11-24 Thread Christoph Hellwig
bd_part is never NULL for a block device in use by a file system, so remove the checks. Signed-off-by: Christoph Hellwig --- fs/f2fs/checkpoint.c | 5 + fs/f2fs/sysfs.c | 9 - 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoin

[dm-devel] [PATCH 38/45] block: switch partition lookup to use struct block_device

2020-11-24 Thread Christoph Hellwig
Use struct block_device to lookup partitions on a disk. This removes all usage of struct hd_struct from the I/O path, and this allows removing the percpu refcount in struct hd_struct. Signed-off-by: Christoph Hellwig --- block/bio.c| 4 +- block/blk-core.c

[dm-devel] [PATCH 40/45] block: pass a block_device to blk_alloc_devt

2020-11-24 Thread Christoph Hellwig
Pass the block_device actually needed instead of the hd_struct. Signed-off-by: Christoph Hellwig --- block/blk.h | 2 +- block/genhd.c | 14 +++--- block/partitions/core.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/block/blk.h b/block/b

[dm-devel] [PATCH 45/45] block: stop using bdget_disk for partition 0

2020-11-24 Thread Christoph Hellwig
We can just dereference the point in struct gendisk instead. Also remove the now unused export. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- block/genhd.c | 1 - drivers/block/nbd.c | 4 +--- drivers/block/xen-blkfr

[dm-devel] [PATCH 36/45] block: move the policy field to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the policy field to struct block_device and rename it to the more descriptive bd_read_only. Also turn the field into a bool as it is used as such. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 2 +- block/genhd.c | 8 block/ioctl.c | 2 +-

[dm-devel] [PATCH 31/45] block: move disk stat accounting to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the dkstats and stamp field to struct block_device in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-cgroup.c| 2 +- block/blk-core.c | 4 ++-- block/blk.h | 1 - block/genhd.c | 14 -- block/

[dm-devel] [PATCH 41/45] block: pass a block_device to invalidate_partition

2020-11-24 Thread Christoph Hellwig
Pass the block_device actually needed instead of looking it up using bdget_disk. Signed-off-by: Christoph Hellwig --- block/genhd.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 498c816e90df64..2985740eab084b 100644 --- a/b

[dm-devel] [PATCH 44/45] block: merge struct block_device and struct hd_struct

2020-11-24 Thread Christoph Hellwig
Instead of having two structures that represent each block device with different life time rules, merge them into a single one. This also greatly simplifies the reference counting rules, as we can use the inode reference count as the main reference count for the new struct block_device, with the d

[dm-devel] [PATCH 37/45] block: allocate struct hd_struct as part of struct bdev_inode

2020-11-24 Thread Christoph Hellwig
Allocate hd_struct together with struct block_device to pre-load the lifetime rule changes in preparation of merging the two structures. Note that part0 was previously embedded into struct gendisk, but is a separate allocation now, and already points to the block_device instead of the hd_struct.

[dm-devel] [PATCH 15/45] block: use put_device in put_disk

2020-11-24 Thread Christoph Hellwig
Use put_device to put the device instead of poking into the internals and using kobject_put. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- block/genhd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --g

[dm-devel] [PATCH 12/45] block: remove a superflous check in blkpg_do_ioctl

2020-11-24 Thread Christoph Hellwig
sector_t is now always a u64, so this check is not needed. Signed-off-by: Christoph Hellwig --- block/ioctl.c | 9 - 1 file changed, 9 deletions(-) diff --git a/block/ioctl.c b/block/ioctl.c index 6b785181344fe1..0c09bb7a6ff35f 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -35,15 +3

[dm-devel] [PATCH 11/45] block: remove a duplicate __disk_get_part prototype

2020-11-24 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- include/linux/genhd.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 46553d6d602563..22f5b9fd96f8bf 100644 --- a/in

[dm-devel] [PATCH 16/45] block: change the hash used for looking up block devices

2020-11-24 Thread Christoph Hellwig
Adding the minor to the major creates tons of pointless conflicts. Just use the dev_t itself, which is 32-bits and thus is guaranteed to fit into ino_t. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- fs/block_dev.c | 26 ++ 1

[dm-devel] [PATCH 24/45] blk-cgroup: stop abusing get_gendisk

2020-11-24 Thread Christoph Hellwig
Properly open the device instead of relying on deep internals by using get_gendisk. Note that this uses FMODE_NDELAY without either FMODE_READ or FMODE_WRITE, which is a special open mode to allow for opening without media access, thus avoiding unexpexted interactions especially on removable media

[dm-devel] [PATCH 28/45] block: simplify part_to_disk

2020-11-24 Thread Christoph Hellwig
Now that struct hd_struct has a block_device pointer use that to find the disk. Signed-off-by: Christoph Hellwig --- include/linux/genhd.h | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index d068e46f9086ae..dcf86a3d4d

[dm-devel] [PATCH 21/45] block: refactor blkdev_get

2020-11-24 Thread Christoph Hellwig
Move more code that is only run on the outer open but not the open of the underlying whole device when opening a partition into blkdev_get, which leads to a much easier to follow structure. This allows to simplify the disk and module refcounting so that one reference is held for each open, similar

[dm-devel] [PATCH 27/45] block: simplify the block device claiming interface

2020-11-24 Thread Christoph Hellwig
Stop passing the whole device as a separate argument given that it can be trivially deducted and cleanup the !holder debug check. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- drivers/block/loop.c | 12 +- fs/block_dev.c | 51 +

[dm-devel] [PATCH 14/45] block: use disk_part_iter_exit in disk_part_iter_next

2020-11-24 Thread Christoph Hellwig
Call disk_part_iter_exit in disk_part_iter_next instead of duplicating the functionality. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- block/genhd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --gi

[dm-devel] merge struct block_device and struct hd_struct v2

2020-11-24 Thread Christoph Hellwig
Hi Jens, this series cleans up our main per-device node data structure by merging the block_device and hd_struct data structures that have the same scope, but different life times. The main effect (besides removing lots of code) is that instead of having two device sizes that need complex synchro

[dm-devel] [PATCH 05/45] mtip32xx: remove the call to fsync_bdev on removal

2020-11-24 Thread Christoph Hellwig
del_gendisk already calls fsync_bdev for every partition, no need to do this twice. Signed-off-by: Christoph Hellwig --- drivers/block/mtip32xx/mtip32xx.c | 15 --- drivers/block/mtip32xx/mtip32xx.h | 2 -- 2 files changed, 17 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32

[dm-devel] [PATCH 33/45] block: move the partition_meta_info to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the partition_meta_info to struct block_device in preparation for killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk.h | 1 - block/genhd.c | 3 ++- block/partitions/core.c | 18 +++--- fs/block_dev.c| 1 + include

[dm-devel] [PATCH 19/45] init: cleanup match_dev_by_uuid and match_dev_by_label

2020-11-24 Thread Christoph Hellwig
Avoid a totally pointless goto label, and use the same style of comparism for both helpers. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- init/do_mounts.c | 18 ++ 1 file changed, 6 insertions(+), 12

[dm-devel] [PATCH 22/45] block: opencode devcgroup_inode_permission

2020-11-24 Thread Christoph Hellwig
Just call devcgroup_check_permission to avoid various superflous checks and a double conversion of the access flags. Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 2ffa11a95f

Re: [dm-devel] [PATCH 38/45] block: switch partition lookup to use struct block_device

2020-11-24 Thread Coly Li
On 11/24/20 9:27 PM, Christoph Hellwig wrote: > Use struct block_device to lookup partitions on a disk. This removes > all usage of struct hd_struct from the I/O path, and this allows removing > the percpu refcount in struct hd_struct. > > Signed-off-by: Christoph Hellwig For the bcache part,

[dm-devel] [PATCH 23/45] block: remove i_bdev

2020-11-24 Thread Christoph Hellwig
Switch the block device lookup interfaces to directly work with a dev_t so that struct block_device references are only acquired by the blkdev_get variants (and the blk-cgroup special case). This means that we not don't need an extra reference in the inode and can generally simplify handling of st

[dm-devel] [PATCH 02/45] filemap: consistently use ->f_mapping over ->i_mapping

2020-11-24 Thread Christoph Hellwig
Use file->f_mapping in all remaining places that have a struct file available to properly handle the case where inode->i_mapping != file_inode(file)->i_mapping. Signed-off-by: Christoph Hellwig --- mm/filemap.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/

[dm-devel] [PATCH 03/45] fs: remove get_super_thawed and get_super_exclusive_thawed

2020-11-24 Thread Christoph Hellwig
Just open code the wait in the only caller of both functions. Signed-off-by: Christoph Hellwig --- fs/internal.h | 2 ++ fs/quota/quota.c | 31 +--- fs/super.c | 51 ++ include/linux/fs.h | 4 +--- 4 files chang

[dm-devel] [PATCH 06/45] zram: remove the claim mechanism

2020-11-24 Thread Christoph Hellwig
The zram claim mechanism was added to ensure no new opens come in during teardown. But the proper way to archive that is to call del_gendisk first, which takes care of all that. Once del_gendisk is called in the right place, the reset side can also be simplified as no I/O can be outstanding on a

[dm-devel] [PATCH 20/45] block: refactor __blkdev_put

2020-11-24 Thread Christoph Hellwig
Reorder the code to have one big section for the last close, and to use bdev_is_partition. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- fs/block_dev.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/block_dev.c

[dm-devel] [PATCH 18/45] init: refactor devt_from_partuuid

2020-11-24 Thread Christoph Hellwig
The code in devt_from_partuuid is very convoluted. Refactor a bit by sanitizing the goto and variable name usage. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara --- init/do_mounts.c | 68 ++-- 1 file changed,

[dm-devel] [PATCH 01/45] blk-cgroup: fix a hd_struct leak in blkcg_fill_root_iostats

2020-11-24 Thread Christoph Hellwig
disk_get_part needs to be paired with a disk_put_part. Fixes: ef45fe470e1 ("blk-cgroup: show global disk stats in root cgroup io.stat") Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn Acked-by: Tejun Heo --- block/blk-cgr

[dm-devel] [PATCH 10/45] dm: remove the block_device reference in struct mapped_device

2020-11-24 Thread Christoph Hellwig
Get rid of the long-lasting struct block_device reference in struct mapped_device. The only remaining user is the freeze code, where we can trivially look up the block device at freeze time and release the reference at thaw time. Signed-off-by: Christoph Hellwig Acked-by: Mike Snitzer --- driv

[dm-devel] [PATCH 17/45] init: refactor name_to_dev_t

2020-11-24 Thread Christoph Hellwig
Split each case into a self-contained helper, and move the block dependent code entirely under the pre-existing #ifdef CONFIG_BLOCK. This allows to remove the blk_lookup_devt stub in genhd.h. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Joh

[dm-devel] [PATCH 13/45] block: add a bdev_kobj helper

2020-11-24 Thread Christoph Hellwig
Add a little helper to find the kobject for a struct block_device. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Thumshirn --- drivers/md/bcache/super.c | 7 ++- drivers/md/md.c | 4 +--- fs/block_dev.c

[dm-devel] [PATCH 34/45] block: move holder_dir to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the holder_dir field to struct block_device in preparation for kill struct hd_struct. Signed-off-by: Christoph Hellwig --- block/genhd.c | 5 +++-- block/partitions/core.c | 8 fs/block_dev.c| 11 +-- include/linux/blk_types.h | 1 + include/lin

[dm-devel] [PATCH 07/45] zram: do not call set_blocksize

2020-11-24 Thread Christoph Hellwig
set_blocksize is used by file systems to use their preferred buffer cache block size. Block drivers should not set it. Signed-off-by: Christoph Hellwig --- drivers/block/zram/zram_drv.c | 11 +-- drivers/block/zram/zram_drv.h | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) dif

[dm-devel] [PATCH 04/45] fs: simplify freeze_bdev/thaw_bdev

2020-11-24 Thread Christoph Hellwig
Store the frozen superblock in struct block_device to avoid the awkward interface that can return a sb only used a cookie, an ERR_PTR or NULL. Signed-off-by: Christoph Hellwig --- drivers/md/dm-core.h | 5 - drivers/md/dm.c | 20 ++-- fs/block_dev.c

[dm-devel] [PATCH 09/45] dm: simplify flush_bio initialization in __send_empty_flush

2020-11-24 Thread Christoph Hellwig
We don't really need the struct block_device to initialize a bio. So switch from using bio_set_dev to manually setting up bi_disk (bi_partno will always be zero and has been cleared by bio_init already). Signed-off-by: Christoph Hellwig Acked-by: Mike Snitzer --- drivers/md/dm.c | 12 +++--

[dm-devel] [PATCH 26/45] block: remove ->bd_contains

2020-11-24 Thread Christoph Hellwig
Now that each hd_struct has a reference to the corresponding block_device, there is no need for the bd_contains pointer. Add a bdev_whole() helper to look up the whole device block_device struture instead. Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara -

[dm-devel] [PATCH 29/45] block: initialize struct block_device in bdev_alloc

2020-11-24 Thread Christoph Hellwig
Don't play tricks with slab constructors as bdev structures tends to not get reused very much, and this makes the code a lot less error prone. Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 22 +- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/fs/block_

[dm-devel] [PATCH 08/45] loop: do not call set_blocksize

2020-11-24 Thread Christoph Hellwig
set_blocksize is used by file systems to use their preferred buffer cache block size. Block drivers should not set it. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 9a27d4f1c08aac

[dm-devel] [PATCH 30/45] block: remove the nr_sects field in struct hd_struct

2020-11-24 Thread Christoph Hellwig
Now that the hd_struct always has a block device attached to it, there is no need for having two size field that just get out of sync. Additional the field in hd_struct did not use proper serializiation, possibly allowing for torn writes. By only using the block_device field this problem also get

[dm-devel] [PATCH 25/45] block: reference struct block_device from struct hd_struct

2020-11-24 Thread Christoph Hellwig
To simplify block device lookup and a few other upcoming areas, make sure that we always have a struct block_device available for each disk and each partition. The only downside of this is that each device and partition uses a little more memory. The upside will be that a lot of code can be simpl

[dm-devel] [PATCH 32/45] block: move the start_sect field to struct block_device

2020-11-24 Thread Christoph Hellwig
Move the start_sect field to struct block_device in preparation of killing struct hd_struct. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 5 +++-- block/blk-lib.c | 2 +- block/genhd.c | 4 ++-- block/partitions/core.c | 17 + includ

Re: [dm-devel] [PATCH 30/45] block: remove the nr_sects field in struct hd_struct

2020-11-24 Thread Coly Li
On 11/24/20 9:27 PM, Christoph Hellwig wrote: > Now that the hd_struct always has a block device attached to it, there is > no need for having two size field that just get out of sync. > > Additional the field in hd_struct did not use proper serializiation, > possibly allowing for torn writes. By

Re: [dm-devel] [PATCH 23/45] block: remove i_bdev

2020-11-24 Thread Coly Li
On 11/24/20 9:27 PM, Christoph Hellwig wrote: > Switch the block device lookup interfaces to directly work with a dev_t > so that struct block_device references are only acquired by the > blkdev_get variants (and the blk-cgroup special case). This means that > we not don't need an extra reference

Re: [dm-devel] [PATCH 13/45] block: add a bdev_kobj helper

2020-11-24 Thread Coly Li
On 11/24/20 9:27 PM, Christoph Hellwig wrote: > Add a little helper to find the kobject for a struct block_device. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jan Kara > Reviewed-by: Johannes Thumshirn For the bcache part, Acked-by: Coly Li Thanks.

Re: [dm-devel] [PATCH 02/45] filemap: consistently use ->f_mapping over ->i_mapping

2020-11-24 Thread Matthew Wilcox
On Tue, Nov 24, 2020 at 02:27:08PM +0100, Christoph Hellwig wrote: > Use file->f_mapping in all remaining places that have a struct file > available to properly handle the case where inode->i_mapping != > file_inode(file)->i_mapping. > > Signed-off-by: Christoph Hellwig Reviewed-by: Matthew Wilc

Re: [dm-devel] [PATCH 11/20] block: reference struct block_device from struct hd_struct

2020-11-24 Thread Tejun Heo
Hello, This is great. So much simpler & better. Some nits below. > diff --git a/block/partitions/core.c b/block/partitions/core.c > index a02e224115943d..0ba0bf44b88af3 100644 > --- a/block/partitions/core.c > +++ b/block/partitions/core.c > @@ -340,12 +340,11 @@ void delete_partition(struct hd_s

Re: [dm-devel] [PATCH 12/45] block: remove a superflous check in blkpg_do_ioctl

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:18PM +0100, Christoph Hellwig wrote: > sector_t is now always a u64, so this check is not needed. > > Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo -- tejun -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 11/45] block: remove a duplicate __disk_get_part prototype

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:17PM +0100, Christoph Hellwig wrote: > Signed-off-by: Christoph Hellwig > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jan Kara > Reviewed-by: Johannes Thumshirn Acked-by: Tejun Heo -- tejun -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com

Re: [dm-devel] [PATCH 13/45] block: add a bdev_kobj helper

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:19PM +0100, Christoph Hellwig wrote: > Add a little helper to find the kobject for a struct block_device. Acked-by: Tejun Heo -- tejun -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 14/45] block: use disk_part_iter_exit in disk_part_iter_next

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:20PM +0100, Christoph Hellwig wrote: > Call disk_part_iter_exit in disk_part_iter_next instead of duplicating > the functionality. Acked-by: Tejun Heo -- tejun -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH 16/45] block: change the hash used for looking up block devices

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:22PM +0100, Christoph Hellwig wrote: > Adding the minor to the major creates tons of pointless conflicts. Just > use the dev_t itself, which is 32-bits and thus is guaranteed to fit > into ino_t. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Greg Kroah-Hartman

Re: [dm-devel] [PATCH 15/45] block: use put_device in put_disk

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:21PM +0100, Christoph Hellwig wrote: > Use put_device to put the device instead of poking into the internals > and using kobject_put. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jan Kara > Reviewed-by: Johannes Thumshirn

Re: [dm-devel] [PATCH 17/45] init: refactor name_to_dev_t

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:23PM +0100, Christoph Hellwig wrote: > Split each case into a self-contained helper, and move the block > dependent code entirely under the pre-existing #ifdef CONFIG_BLOCK. > This allows to remove the blk_lookup_devt stub in genhd.h. > > Signed-off-by: Christoph Hell

Re: [dm-devel] [PATCH 18/45] init: refactor devt_from_partuuid

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:24PM +0100, Christoph Hellwig wrote: > The code in devt_from_partuuid is very convoluted. Refactor a bit by > sanitizing the goto and variable name usage. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jan Kara Acked-by: Tej

Re: [dm-devel] [PATCH 19/45] init: cleanup match_dev_by_uuid and match_dev_by_label

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:25PM +0100, Christoph Hellwig wrote: > Avoid a totally pointless goto label, and use the same style of > comparism for both helpers. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jan Kara > Reviewed-by: Johannes Thumshirn A

Re: [dm-devel] [PATCH 20/45] block: refactor __blkdev_put

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:26PM +0100, Christoph Hellwig wrote: > Reorder the code to have one big section for the last close, and to use > bdev_is_partition. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jan Kara Acked-by: Tejun Heo -- tejun -- d

Re: [dm-devel] [PATCH 21/45] block: refactor blkdev_get

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:27PM +0100, Christoph Hellwig wrote: > Move more code that is only run on the outer open but not the open of > the underlying whole device when opening a partition into blkdev_get, > which leads to a much easier to follow structure. > > This allows to simplify the dis

Re: [dm-devel] [PATCH 22/45] block: opencode devcgroup_inode_permission

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:28PM +0100, Christoph Hellwig wrote: > Just call devcgroup_check_permission to avoid various superflous checks > and a double conversion of the access flags. > > Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo -- tejun -- dm-devel mailing list dm-devel@redh

Re: [dm-devel] [PATCH 23/45] block: remove i_bdev

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:29PM +0100, Christoph Hellwig wrote: > Switch the block device lookup interfaces to directly work with a dev_t > so that struct block_device references are only acquired by the > blkdev_get variants (and the blk-cgroup special case). This means that > we not don't nee

Re: [dm-devel] [PATCH 24/45] blk-cgroup: stop abusing get_gendisk

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:30PM +0100, Christoph Hellwig wrote: > Properly open the device instead of relying on deep internals by > using get_gendisk. Note that this uses FMODE_NDELAY without either > FMODE_READ or FMODE_WRITE, which is a special open mode to allow > for opening without media

Re: [dm-devel] [RFC PATCH] libmultipath: prevent DSO unloading with astray checker threads

2020-11-24 Thread Benjamin Marzinski
On Fri, Nov 06, 2020 at 06:32:16PM +0100, Martin Wilck wrote: > On Thu, 2020-11-05 at 18:41 -0600, Benjamin Marzinski wrote: > > > > I can't make this segfault. So that looks good, but it does need > > libmultipath.version updated to include checker_thread_entry() > > Great news, thanks. Well the

Re: [dm-devel] [PATCH 25/45] block: reference struct block_device from struct hd_struct

2020-11-24 Thread Tejun Heo
Hello, Please see lkml.kernel.org/r/x708btj5njtbc...@mtj.duckdns.org for a few nits on the previous version. On Tue, Nov 24, 2020 at 02:27:31PM +0100, Christoph Hellwig wrote: > To simplify block device lookup and a few other upcoming areas, make sure > that we always have a struct block_device a

Re: [dm-devel] [PATCH 26/45] block: remove ->bd_contains

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:32PM +0100, Christoph Hellwig wrote: > Now that each hd_struct has a reference to the corresponding > block_device, there is no need for the bd_contains pointer. Add > a bdev_whole() helper to look up the whole device block_device > struture instead. > > Signed-off-b

Re: [dm-devel] [PATCH 27/45] block: simplify the block device claiming interface

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:33PM +0100, Christoph Hellwig wrote: > Stop passing the whole device as a separate argument given that it > can be trivially deducted and cleanup the !holder debug check. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jan Kara

Re: [dm-devel] [PATCH 28/45] block: simplify part_to_disk

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:34PM +0100, Christoph Hellwig wrote: > Now that struct hd_struct has a block_device pointer use that to > find the disk. > > Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo -- tejun -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman

Re: [dm-devel] [PATCH 29/45] block: initialize struct block_device in bdev_alloc

2020-11-24 Thread Tejun Heo
On Tue, Nov 24, 2020 at 02:27:35PM +0100, Christoph Hellwig wrote: > Don't play tricks with slab constructors as bdev structures tends to not > get reused very much, and this makes the code a lot less error prone. > > Signed-off-by: Christoph Hellwig Acked-by: Tejun Heo -- tejun -- dm-devel

Re: [dm-devel] [RFC PATCH] libmultipath: prevent DSO unloading with astray checker threads

2020-11-24 Thread Martin Wilck
On Tue, 2020-11-24 at 14:33 -0600, Benjamin Marzinski wrote: > On Fri, Nov 06, 2020 at 06:32:16PM +0100, Martin Wilck wrote: > > On Thu, 2020-11-05 at 18:41 -0600, Benjamin Marzinski wrote: > > > I can't make this segfault. So that looks good, but it does need > > > libmultipath.version updated to

Re: [dm-devel] [PATCH 01/45] blk-cgroup: fix a hd_struct leak in blkcg_fill_root_iostats

2020-11-24 Thread Hannes Reinecke
On 11/24/20 2:27 PM, Christoph Hellwig wrote: disk_get_part needs to be paired with a disk_put_part. Fixes: ef45fe470e1 ("blk-cgroup: show global disk stats in root cgroup io.stat") Signed-off-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Jan Kara Reviewed-by: Johannes Th

Re: [dm-devel] [PATCH 02/45] filemap: consistently use ->f_mapping over ->i_mapping

2020-11-24 Thread Hannes Reinecke
On 11/24/20 2:27 PM, Christoph Hellwig wrote: Use file->f_mapping in all remaining places that have a struct file available to properly handle the case where inode->i_mapping != file_inode(file)->i_mapping. Signed-off-by: Christoph Hellwig --- mm/filemap.c | 13 ++--- 1 file changed,

Re: [dm-devel] [PATCH 03/45] fs: remove get_super_thawed and get_super_exclusive_thawed

2020-11-24 Thread Hannes Reinecke
On 11/24/20 2:27 PM, Christoph Hellwig wrote: Just open code the wait in the only caller of both functions. Signed-off-by: Christoph Hellwig --- fs/internal.h | 2 ++ fs/quota/quota.c | 31 +--- fs/super.c | 51 ++--

Re: [dm-devel] [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Miguel Ojeda
On Tue, Nov 24, 2020 at 11:24 PM Finn Thain wrote: > > These statements are not "missing" unless you presume that code written > before the latest de facto language spec was written should somehow be > held to that spec. There is no "language spec" the kernel adheres to. Even if it did, kernel co

Re: [dm-devel] [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Kees Cook
On Mon, Nov 23, 2020 at 08:31:30AM -0800, James Bottomley wrote: > Really, no ... something which produces no improvement has no value at > all ... we really shouldn't be wasting maintainer time with it because > it has a cost to merge. I'm not sure we understand where the balance > lies in value

Re: [dm-devel] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Miguel Ojeda
On Tue, Nov 24, 2020 at 1:58 AM Finn Thain wrote: > > What I meant was that you've used pessimism as if it was fact. "future mistakes that it might prevent" is neither pessimism nor states a fact. > For example, "There is no way to guess what the effect would be if the > compiler trained program

Re: [dm-devel] [PATCH 30/45] block: remove the nr_sects field in struct hd_struct

2020-11-24 Thread Chao Yu
On 2020/11/24 21:27, Christoph Hellwig wrote: Now that the hd_struct always has a block device attached to it, there is no need for having two size field that just get out of sync. Additional the field in hd_struct did not use proper serializiation, possibly allowing for torn writes. By only us

Re: [dm-devel] [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Miguel Ojeda
On Wed, Nov 25, 2020 at 12:53 AM Finn Thain wrote: > > I'm saying that supporting the official language spec makes more sense > than attempting to support a multitude of divergent interpretations of the > spec (i.e. gcc, clang, coverity etc.) Making the kernel strictly conforming is a ship that s

  1   2   >