From 8eebed57c21e311a489f17ef359c464e7fd3c87f Mon Sep 17 00:00:00 2001 From: Eryu Guan Date: Sun, 11 Apr 2021 13:14:40 +0800 Subject: [PATCH 2683/2944] alinux: virtiofs: accept 'virtio_fs' filesystem type as well fix #33850294 The filesystem type of virtio-fs has been renamed from 'virtio_fs' to 'virtiofs' in upstream. So let's make it compatible with old kernel and accept 'virtio_fs' filesystem type as well. Acked-by: "Liu, Jiang" Reviewed-by: Joseph Qi Signed-off-by: Eryu Guan --- fs/fuse/virtio_fs.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 1e91963..f7c0895 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -1156,6 +1156,30 @@ static struct dentry *virtio_fs_mount(struct file_system_type *fs_type, .kill_sb = virtio_kill_sb, }; +/* Accept 'virtio_fs' as well to be compatible with old kangaroo runtime */ +static struct file_system_type comp_fs_type = { + .owner = THIS_MODULE, + .name = "virtio_fs", + .mount = virtio_fs_mount, + .kill_sb = virtio_kill_sb, +}; +MODULE_ALIAS_FS("virtio_fs"); +MODULE_ALIAS("virtio_fs"); + +static inline void register_as_virtio_fs(void) +{ + int err = register_filesystem(&comp_fs_type); + + if (err) + pr_warn("virtiofs: Unable to register as virtio_fs (%d)\n", + err); +} + +static inline void unregister_as_virtio_fs(void) +{ + unregister_filesystem(&comp_fs_type); +} + static int __init virtio_fs_init(void) { int ret; @@ -1164,8 +1188,10 @@ static int __init virtio_fs_init(void) if (ret < 0) return ret; + register_as_virtio_fs(); ret = register_filesystem(&virtio_fs_type); if (ret < 0) { + unregister_as_virtio_fs(); unregister_virtio_driver(&virtio_fs_driver); return ret; } @@ -1176,6 +1202,7 @@ static int __init virtio_fs_init(void) static void __exit virtio_fs_exit(void) { + unregister_as_virtio_fs(); unregister_filesystem(&virtio_fs_type); unregister_virtio_driver(&virtio_fs_driver); } -- 1.8.3.1