Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fuse: fix bdi naming conflict

Fuse allocates a separate bdi for each filesystem, and registers them
in sysfs with "MAJOR:MINOR" of sb->s_dev (st_dev). This works fine for
anon devices normally used by fuse, but can conflict with an already
registered BDI for "fuseblk" filesystems, where sb->s_dev represents a
real block device. In particularl this happens if a non-partitioned
device is being mounted.

Fix by registering with a different name for "fuseblk" filesystems.

Thanks to Ioan Ionita for the bug report.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reported-by: Ioan Ionita <opslynx@gmail.com>
Tested-by: Ioan Ionita <opslynx@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Miklos Szeredi and committed by
Linus Torvalds
03fb0bce 42172d75

+10 -1
+4
Documentation/ABI/testing/sysfs-class-bdi
··· 14 14 non-block filesystems which provide their own BDI, such as NFS 15 15 and FUSE. 16 16 17 + MAJOR:MINOR-fuseblk 18 + 19 + Value of st_dev on fuseblk filesystems. 20 + 17 21 default 18 22 19 23 The default backing dev, used for non-block device backed
+6 -1
fs/fuse/inode.c
··· 488 488 err = bdi_init(&fc->bdi); 489 489 if (err) 490 490 goto error_kfree; 491 - err = bdi_register_dev(&fc->bdi, fc->dev); 491 + if (sb->s_bdev) { 492 + err = bdi_register(&fc->bdi, NULL, "%u:%u-fuseblk", 493 + MAJOR(fc->dev), MINOR(fc->dev)); 494 + } else { 495 + err = bdi_register_dev(&fc->bdi, fc->dev); 496 + } 492 497 if (err) 493 498 goto error_bdi_destroy; 494 499 /*