mbox series

[0/2] mtd: switch to keying by dev_t

Message ID 20230829-vfs-super-mtd-v1-0-fecb572e5df3@kernel.org (mailing list archive)
Headers show
Series mtd: switch to keying by dev_t | expand

Message

Christian Brauner Aug. 29, 2023, 3:23 p.m. UTC
Hey,

For this cycle Jan, Christoph, and myself switched the generic super
code to key superblocks for block devices by device number (sb->s_dev)
instead of block device pointers (sb->s_bdev).

Not just does this allow us to defer opening block devices after we
allocated a superblock it also allows us to move closing block devices
to a later point to avoid various deadlocks.

Similar to the generic code for block devices we need to switch mtd
devices to rely on sb->s_dev instead of sb->s_mtd to avoid potential
use-after-free issues.

I plan on taking this upstream as a fix during the merge window.

Thanks!
Christian

---



---
base-commit: dc3216b1416056b04712e53431f6e9aefdc83177
change-id: 20230829-vfs-super-mtd-1bb602abfc00

Comments

Christian Brauner Aug. 30, 2023, 9:50 a.m. UTC | #1
> I plan on taking this upstream as a fix during the merge window.

Btw, I tested this all with jffs2:

sudo flash_erase -j /dev/mtd0 0 0
sudo mount -t jffs2 mtd0 /mnt

and then some variants with racing umounts and mounts.
Richard Weinberger Aug. 30, 2023, 10:15 a.m. UTC | #2
----- Ursprüngliche Mail -----
> Von: "Christian Brauner" <brauner@kernel.org>
> An: "hch" <hch@lst.de>, "Jan Kara" <jack@suse.cz>, "richard" <richard@nod.at>
> CC: "Miquel Raynal" <miquel.raynal@bootlin.com>, "Vignesh Raghavendra" <vigneshr@ti.com>, "linux-mtd"
> <linux-mtd@lists.infradead.org>, "linux-fsdevel" <linux-fsdevel@vger.kernel.org>
> Gesendet: Mittwoch, 30. August 2023 11:50:58
> Betreff: Re: [PATCH 0/2] mtd: switch to keying by dev_t

>> I plan on taking this upstream as a fix during the merge window.
> 
> Btw, I tested this all with jffs2:
> 
> sudo flash_erase -j /dev/mtd0 0 0
> sudo mount -t jffs2 mtd0 /mnt
> 
> and then some variants with racing umounts and mounts.

Good to know!
Acked-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard
Christoph Hellwig Aug. 30, 2023, 11:52 a.m. UTC | #3
The series with all the updates from this thread looks good to me:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Christian Brauner Aug. 30, 2023, 12:19 p.m. UTC | #4
On Tue, 29 Aug 2023 17:23:55 +0200, Christian Brauner wrote:
> Hey,
> 
> For this cycle Jan, Christoph, and myself switched the generic super
> code to key superblocks for block devices by device number (sb->s_dev)
> instead of block device pointers (sb->s_bdev).
> 
> Not just does this allow us to defer opening block devices after we
> allocated a superblock it also allows us to move closing block devices
> to a later point to avoid various deadlocks.
> 
> [...]

Applied to the vfs.super branch of the vfs/vfs.git tree.
Patches in the vfs.super branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.super

[1/2] fs: export sget_dev()
      https://git.kernel.org/vfs/vfs/c/9c4d12957d16
[2/2] mtd: key superblock by device number
      https://git.kernel.org/vfs/vfs/c/ff7c9910eaad