diff mbox series

[v3] fs: fsconfig: intercept non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL command

Message ID 20240625121831.1833081-1-lihongbo22@huawei.com (mailing list archive)
State New
Headers show
Series [v3] fs: fsconfig: intercept non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL command | expand

Commit Message

Hongbo Li June 25, 2024, 12:18 p.m. UTC
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>
Reviewed-by: Jan Kara <jack@suse.cz>
---
v3:
  - Add reviewed-by.

v2: https://lore.kernel.org/all/20240522030422.315892-1-lihongbo22@huawei.com/
  - Fix misspelling and change the target branch.

v1: https://lore.kernel.org/all/20240511062147.3312801-1-lihongbo22@huawei.com/T/
---
 fs/fsopen.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Jan Kara June 25, 2024, 12:28 p.m. UTC | #1
On Tue 25-06-24 20:18:31, Hongbo Li wrote:
> 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>
> Reviewed-by: Jan Kara <jack@suse.cz>

The patch is already in VFS tree:
https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs.misc&id=ef44c8ab06b300a5b9b30e5b630f491ac7bc4d3e

It just didn't reach Linus' tree yet because it is not urgent fix.

								Honza

> ---
> v3:
>   - Add reviewed-by.
> 
> v2: https://lore.kernel.org/all/20240522030422.315892-1-lihongbo22@huawei.com/
>   - Fix misspelling and change the target branch.
> 
> v1: https://lore.kernel.org/all/20240511062147.3312801-1-lihongbo22@huawei.com/T/
> ---
>  fs/fsopen.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/fsopen.c b/fs/fsopen.c
> index 6593ae518115..18fe979da7e2 100644
> --- a/fs/fsopen.c
> +++ b/fs/fsopen.c
> @@ -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;
>  		}
> -- 
> 2.34.1
>
Hongbo Li June 25, 2024, 12:43 p.m. UTC | #2
On 2024/6/25 20:28, Jan Kara wrote:
> On Tue 25-06-24 20:18:31, Hongbo Li wrote:
>> 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>
>> Reviewed-by: Jan Kara <jack@suse.cz>
> 
> The patch is already in VFS tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs.misc&id=ef44c8ab06b300a5b9b30e5b630f491ac7bc4d3e
> 
> It just didn't reach Linus' tree yet because it is not urgent fix.
> 
> 								Honza
> 
oh,thanks, I didn't realize this. Just ignore it! ^_^

Thanks,
Hongbo
>> ---
>> v3:
>>    - Add reviewed-by.
>>
>> v2: https://lore.kernel.org/all/20240522030422.315892-1-lihongbo22@huawei.com/
>>    - Fix misspelling and change the target branch.
>>
>> v1: https://lore.kernel.org/all/20240511062147.3312801-1-lihongbo22@huawei.com/T/
>> ---
>>   fs/fsopen.c | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/fs/fsopen.c b/fs/fsopen.c
>> index 6593ae518115..18fe979da7e2 100644
>> --- a/fs/fsopen.c
>> +++ b/fs/fsopen.c
>> @@ -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;
>>   		}
>> -- 
>> 2.34.1
>>
diff mbox series

Patch

diff --git a/fs/fsopen.c b/fs/fsopen.c
index 6593ae518115..18fe979da7e2 100644
--- a/fs/fsopen.c
+++ b/fs/fsopen.c
@@ -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;
 		}