fs: fsconfig: intercept non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL...
authorHongbo Li <lihongbo22@huawei.com>
Wed, 22 May 2024 03:04:22 +0000 (11:04 +0800)
committerChristian Brauner <brauner@kernel.org>
Mon, 27 May 2024 13:58:46 +0000 (15:58 +0200)
fsconfig with FSCONFIG_CMD_CREATE_EXCL command requires the new mount api,
here we should return -EOPNOTSUPP in advance to avoid extra procedure.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Link: https://lore.kernel.org/r/20240522030422.315892-1-lihongbo22@huawei.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/fsopen.c

index 6593ae5..18fe979 100644 (file)
@@ -220,10 +220,6 @@ static int vfs_cmd_create(struct fs_context *fc, bool exclusive)
        if (!mount_capable(fc))
                return -EPERM;
 
-       /* require the new mount api */
-       if (exclusive && fc->ops == &legacy_fs_context_ops)
-               return -EOPNOTSUPP;
-
        fc->phase = FS_CONTEXT_CREATING;
        fc->exclusive = exclusive;
 
@@ -411,6 +407,7 @@ SYSCALL_DEFINE5(fsconfig,
                case FSCONFIG_SET_PATH:
                case FSCONFIG_SET_PATH_EMPTY:
                case FSCONFIG_SET_FD:
+               case FSCONFIG_CMD_CREATE_EXCL:
                        ret = -EOPNOTSUPP;
                        goto out_f;
                }