Skip to content

Commit 6c7873e

Browse files
committed
[vpsAdminOS] Hide ZFS from container tools
1 parent ad474ab commit 6c7873e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/sys/fs/zfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,7 @@ typedef struct ddt_histogram {
11491149
#define ZFS_SHARETAB "/etc/dfs/sharetab"
11501150

11511151
#define ZFS_SUPER_MAGIC 0x2fc12fc1
1152+
#define ZFS_SHACK_MAGIC 0x13372fc1
11521153

11531154
/* general zvol path */
11541155
#define ZVOL_DIR "/dev"

module/os/linux/zfs/zfs_vfsops.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,7 @@ zfs_statvfs(struct dentry *dentry, struct kstatfs *statp)
14571457
zfsvfs_t *zfsvfs = dentry->d_sb->s_fs_info;
14581458
uint64_t refdbytes, availbytes, usedobjs, availobjs;
14591459
int err = 0;
1460+
bool magic_hack = false;
14601461

14611462
ZFS_ENTER(zfsvfs);
14621463

@@ -1504,6 +1505,17 @@ zfs_statvfs(struct dentry *dentry, struct kstatfs *statp)
15041505
statp->f_type = ZFS_SUPER_MAGIC;
15051506
statp->f_namelen = MAXNAMELEN - 1;
15061507

1508+
if (strcmp(current->comm, "containerd") == 0)
1509+
magic_hack = true;
1510+
if (strcmp(current->comm, "dockerd") == 0)
1511+
magic_hack = true;
1512+
if (strcmp(current->comm, "lxd") == 0)
1513+
magic_hack = true;
1514+
if (magic_hack) {
1515+
printk(KERN_WARNING "ZFS magic faked to %s\n", current->comm);
1516+
statp->f_type = ZFS_SHACK_MAGIC;
1517+
}
1518+
15071519
/*
15081520
* We have all of 40 characters to stuff a string here.
15091521
* Is there anything useful we could/should provide?

0 commit comments

Comments
 (0)