Skip to content

Commit

Permalink
fuse: fix bdi naming conflict
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed May 24, 2008
1 parent 42172d7 commit 03fb0bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Documentation/ABI/testing/sysfs-class-bdi
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ MAJOR:MINOR
non-block filesystems which provide their own BDI, such as NFS
and FUSE.

MAJOR:MINOR-fuseblk

Value of st_dev on fuseblk filesystems.

default

The default backing dev, used for non-block device backed
Expand Down
7 changes: 6 additions & 1 deletion fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,12 @@ static struct fuse_conn *new_conn(struct super_block *sb)
err = bdi_init(&fc->bdi);
if (err)
goto error_kfree;
err = bdi_register_dev(&fc->bdi, fc->dev);
if (sb->s_bdev) {
err = bdi_register(&fc->bdi, NULL, "%u:%u-fuseblk",
MAJOR(fc->dev), MINOR(fc->dev));
} else {
err = bdi_register_dev(&fc->bdi, fc->dev);
}
if (err)
goto error_bdi_destroy;
/*
Expand Down

0 comments on commit 03fb0bc

Please sign in to comment.