diff options
author | Amir Goldstein | 2018-03-28 20:22:41 +0300 |
---|---|---|
committer | Miklos Szeredi | 2018-04-12 12:04:50 +0200 |
commit | 5148626b806a74dd219f2bce5f204abf909f6930 (patch) | |
tree | 6798d7117b093018188fe50c112f4dccaba7fd8c /fs/overlayfs/inode.c | |
parent | da309e8c055de8d6461ae01764a3352c77878735 (diff) |
ovl: allocate anon bdev per unique lower fs
Instead of allocating an anonymous bdev per lower layer, allocate
one anonymous bdev per every unique lower fs that is different than
upper fs.
Every unique lower fs is assigned an fsid > 0 and the number of
unique lower fs are stored in ofs->numlowerfs.
The assigned fsid is stored in the lower layer struct and will be
used also for inode number multiplexing.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/inode.c')
-rw-r--r-- | fs/overlayfs/inode.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index 8a283ec21e34..cfccd91c51e3 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -83,14 +83,15 @@ static int ovl_map_dev_ino(struct dentry *dentry, struct kstat *stat, */ stat->dev = dentry->d_sb->s_dev; stat->ino = dentry->d_inode->i_ino; - } else if (lower_layer) { + } else if (lower_layer && lower_layer->fsid) { /* * For non-samefs setup, if we cannot map all layers st_ino * to a unified address space, we need to make sure that st_dev - * is unique per layer. Upper layer uses real st_dev and lower - * layers use the unique anonymous bdev. + * is unique per lower fs. Upper layer uses real st_dev and + * lower layers use the unique anonymous bdev assigned to the + * lower fs. */ - stat->dev = lower_layer->pseudo_dev; + stat->dev = lower_layer->fs->pseudo_dev; } return 0; |