Re: [PATCH 0/3] fanotify support for btrfs sub-volumes

Christian Brauner
2023-11-08T08:22:39Z

On Wed, Nov 08, 2023 at 12:12:36AM -0800, Christoph Hellwig wrote:
> On Wed, Nov 08, 2023 at 09:09:10AM +0100, Christian Brauner wrote:
> > > a bind mount can of course change the dev_t - if it points to a
> > > different super block at the moment.
> >
> > No, a bind mount just takes an existing directory tree of an existing
> > filesystem and makes it visible on some location in the filesystem
> > hierarchy. It doesn't change the device number it will inherit it from
> > the superblock it belongs.
>
> That's what I'm trying to say.
>
> So if you have:
>
> /mnt/1/ with dev 8
> /mnt/2/ with dev 23
>
> then a bind mount of
>
> /mnt/1/foo to /mnt/2/bar will get your dev 8 for /mnt/2/bar
>
> So the device number changes at the mount point here, bind mount or not.

Yes, I know. But /mnt/2/ will have the device number of the
superblock/filesystem it belongs to and so will /mnt/1. Creating a
bind-mount won't suddenly change the device number and decoupling it
from the superblock it is a bind-mount of.