Blob Blame History Raw
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
Patch-mainline: never, depends on vfs-add-super_operations-get_inode_dev
References: bsc#1059336
Subject: ovl: treat btrfs mounts as different superblocks

Since btrfs uses different anonymous dev_t for subvolume
mounts, we treat overlayfs mounts on btrfs as different so
there is no clash of inode numbers in different subvolumes
and device numbers _don't_ match. (overlay uses combination
of inode numbers and dev_t to ensure uniqueness of inodes)

This avoids the trace which is caused on mounting overlayfs on btrfs.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>

diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index d613e2c41242..4fecd06cf3cf 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -114,7 +114,7 @@ int ovl_getattr(const struct path *path, struct kstat *stat,
 		 * -xdev' will scan the entire overlay mount and won't cross the
 		 * overlay mount boundaries.
 		 */
-		stat->dev = dentry->d_sb->s_dev;
+		stat->dev = inode_get_dev(dentry->d_inode);
 		stat->ino = dentry->d_inode->i_ino;
 	}
 
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 04d0c7ed645e..dd9279e00612 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -929,7 +929,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
 		ufs->numlower++;
 
 		/* Check if all lower layers are on same sb */
-		if (i == 0)
+		if ((i == 0) && strcmp(mnt->mnt_sb->s_type->name, "btrfs"))
 			ufs->same_sb = mnt->mnt_sb;
 		else if (ufs->same_sb != mnt->mnt_sb)
 			ufs->same_sb = NULL;