* [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL
@ 2024-05-11 4:02 Hongbo Li
2024-05-11 6:08 ` Hongbo Li
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Hongbo Li @ 2024-05-11 4:02 UTC (permalink / raw)
To: viro, brauner, jack; +Cc: lihongbo22, linux-fsdevel
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>
---
fs/fsopen.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fs/fsopen.c b/fs/fsopen.c
index 6593ae518115..880eea7a30fd 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_EXEC:
ret = -EOPNOTSUPP;
goto out_f;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL
2024-05-11 4:02 [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL Hongbo Li
@ 2024-05-11 6:08 ` Hongbo Li
2024-05-12 13:12 ` kernel test robot
2024-05-12 13:25 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: Hongbo Li @ 2024-05-11 6:08 UTC (permalink / raw)
To: viro, brauner, jack; +Cc: linux-fsdevel
sorry, please ignore this, and I will revise my code.
On 2024/5/11 12:02, 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>
> ---
> fs/fsopen.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/fs/fsopen.c b/fs/fsopen.c
> index 6593ae518115..880eea7a30fd 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_EXEC:
FSCONFIG_CMD_CREATE_EXCL
> ret = -EOPNOTSUPP;
> goto out_f;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL
2024-05-11 4:02 [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL Hongbo Li
2024-05-11 6:08 ` Hongbo Li
@ 2024-05-12 13:12 ` kernel test robot
2024-05-12 13:25 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2024-05-12 13:12 UTC (permalink / raw)
To: Hongbo Li, viro, brauner, jack; +Cc: oe-kbuild-all, lihongbo22, linux-fsdevel
Hi Hongbo,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20240510]
url: https://github.com/intel-lab-lkp/linux/commits/Hongbo-Li/fsconfig-intercept-for-non-new-mount-API-in-advance-for-FSCONFIG_CMD_CREATE_EXCL/20240511-120353
base: next-20240510
patch link: https://lore.kernel.org/r/20240511040249.2141380-1-lihongbo22%40huawei.com
patch subject: [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL
config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20240512/202405122152.lQkWH9DK-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240512/202405122152.lQkWH9DK-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405122152.lQkWH9DK-lkp@intel.com/
All errors (new ones prefixed by >>):
fs/fsopen.c: In function '__do_sys_fsconfig':
>> fs/fsopen.c:410:22: error: 'FSCONFIG_CMD_CREATE_EXEC' undeclared (first use in this function); did you mean 'FSCONFIG_CMD_CREATE_EXCL'?
410 | case FSCONFIG_CMD_CREATE_EXEC:
| ^~~~~~~~~~~~~~~~~~~~~~~~
| FSCONFIG_CMD_CREATE_EXCL
fs/fsopen.c:410:22: note: each undeclared identifier is reported only once for each function it appears in
vim +410 fs/fsopen.c
301
302 /**
303 * sys_fsconfig - Set parameters and trigger actions on a context
304 * @fd: The filesystem context to act upon
305 * @cmd: The action to take
306 * @_key: Where appropriate, the parameter key to set
307 * @_value: Where appropriate, the parameter value to set
308 * @aux: Additional information for the value
309 *
310 * This system call is used to set parameters on a context, including
311 * superblock settings, data source and security labelling.
312 *
313 * Actions include triggering the creation of a superblock and the
314 * reconfiguration of the superblock attached to the specified context.
315 *
316 * When setting a parameter, @cmd indicates the type of value being proposed
317 * and @_key indicates the parameter to be altered.
318 *
319 * @_value and @aux are used to specify the value, should a value be required:
320 *
321 * (*) fsconfig_set_flag: No value is specified. The parameter must be boolean
322 * in nature. The key may be prefixed with "no" to invert the
323 * setting. @_value must be NULL and @aux must be 0.
324 *
325 * (*) fsconfig_set_string: A string value is specified. The parameter can be
326 * expecting boolean, integer, string or take a path. A conversion to an
327 * appropriate type will be attempted (which may include looking up as a
328 * path). @_value points to a NUL-terminated string and @aux must be 0.
329 *
330 * (*) fsconfig_set_binary: A binary blob is specified. @_value points to the
331 * blob and @aux indicates its size. The parameter must be expecting a
332 * blob.
333 *
334 * (*) fsconfig_set_path: A non-empty path is specified. The parameter must be
335 * expecting a path object. @_value points to a NUL-terminated string that
336 * is the path and @aux is a file descriptor at which to start a relative
337 * lookup or AT_FDCWD.
338 *
339 * (*) fsconfig_set_path_empty: As fsconfig_set_path, but with AT_EMPTY_PATH
340 * implied.
341 *
342 * (*) fsconfig_set_fd: An open file descriptor is specified. @_value must be
343 * NULL and @aux indicates the file descriptor.
344 */
345 SYSCALL_DEFINE5(fsconfig,
346 int, fd,
347 unsigned int, cmd,
348 const char __user *, _key,
349 const void __user *, _value,
350 int, aux)
351 {
352 struct fs_context *fc;
353 struct fd f;
354 int ret;
355 int lookup_flags = 0;
356
357 struct fs_parameter param = {
358 .type = fs_value_is_undefined,
359 };
360
361 if (fd < 0)
362 return -EINVAL;
363
364 switch (cmd) {
365 case FSCONFIG_SET_FLAG:
366 if (!_key || _value || aux)
367 return -EINVAL;
368 break;
369 case FSCONFIG_SET_STRING:
370 if (!_key || !_value || aux)
371 return -EINVAL;
372 break;
373 case FSCONFIG_SET_BINARY:
374 if (!_key || !_value || aux <= 0 || aux > 1024 * 1024)
375 return -EINVAL;
376 break;
377 case FSCONFIG_SET_PATH:
378 case FSCONFIG_SET_PATH_EMPTY:
379 if (!_key || !_value || (aux != AT_FDCWD && aux < 0))
380 return -EINVAL;
381 break;
382 case FSCONFIG_SET_FD:
383 if (!_key || _value || aux < 0)
384 return -EINVAL;
385 break;
386 case FSCONFIG_CMD_CREATE:
387 case FSCONFIG_CMD_CREATE_EXCL:
388 case FSCONFIG_CMD_RECONFIGURE:
389 if (_key || _value || aux)
390 return -EINVAL;
391 break;
392 default:
393 return -EOPNOTSUPP;
394 }
395
396 f = fdget(fd);
397 if (!f.file)
398 return -EBADF;
399 ret = -EINVAL;
400 if (f.file->f_op != &fscontext_fops)
401 goto out_f;
402
403 fc = f.file->private_data;
404 if (fc->ops == &legacy_fs_context_ops) {
405 switch (cmd) {
406 case FSCONFIG_SET_BINARY:
407 case FSCONFIG_SET_PATH:
408 case FSCONFIG_SET_PATH_EMPTY:
409 case FSCONFIG_SET_FD:
> 410 case FSCONFIG_CMD_CREATE_EXEC:
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL
2024-05-11 4:02 [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL Hongbo Li
2024-05-11 6:08 ` Hongbo Li
2024-05-12 13:12 ` kernel test robot
@ 2024-05-12 13:25 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2024-05-12 13:25 UTC (permalink / raw)
To: Hongbo Li, viro, brauner, jack
Cc: llvm, oe-kbuild-all, lihongbo22, linux-fsdevel
Hi Hongbo,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20240510]
url: https://github.com/intel-lab-lkp/linux/commits/Hongbo-Li/fsconfig-intercept-for-non-new-mount-API-in-advance-for-FSCONFIG_CMD_CREATE_EXCL/20240511-120353
base: next-20240510
patch link: https://lore.kernel.org/r/20240511040249.2141380-1-lihongbo22%40huawei.com
patch subject: [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL
config: s390-allnoconfig (https://download.01.org/0day-ci/archive/20240512/202405122155.PQ2zWM25-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project b910bebc300dafb30569cecc3017b446ea8eafa0)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240512/202405122155.PQ2zWM25-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405122155.PQ2zWM25-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from fs/fsopen.c:8:
In file included from include/linux/fs_context.h:14:
In file included from include/linux/security.h:33:
In file included from include/linux/mm.h:2253:
include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> fs/fsopen.c:410:8: error: use of undeclared identifier 'FSCONFIG_CMD_CREATE_EXEC'; did you mean 'FSCONFIG_CMD_CREATE_EXCL'?
410 | case FSCONFIG_CMD_CREATE_EXEC:
| ^~~~~~~~~~~~~~~~~~~~~~~~
| FSCONFIG_CMD_CREATE_EXCL
include/uapi/linux/mount.h:105:2: note: 'FSCONFIG_CMD_CREATE_EXCL' declared here
105 | FSCONFIG_CMD_CREATE_EXCL = 8, /* Create new superblock, fail if reusing existing superblock */
| ^
1 warning and 1 error generated.
vim +410 fs/fsopen.c
301
302 /**
303 * sys_fsconfig - Set parameters and trigger actions on a context
304 * @fd: The filesystem context to act upon
305 * @cmd: The action to take
306 * @_key: Where appropriate, the parameter key to set
307 * @_value: Where appropriate, the parameter value to set
308 * @aux: Additional information for the value
309 *
310 * This system call is used to set parameters on a context, including
311 * superblock settings, data source and security labelling.
312 *
313 * Actions include triggering the creation of a superblock and the
314 * reconfiguration of the superblock attached to the specified context.
315 *
316 * When setting a parameter, @cmd indicates the type of value being proposed
317 * and @_key indicates the parameter to be altered.
318 *
319 * @_value and @aux are used to specify the value, should a value be required:
320 *
321 * (*) fsconfig_set_flag: No value is specified. The parameter must be boolean
322 * in nature. The key may be prefixed with "no" to invert the
323 * setting. @_value must be NULL and @aux must be 0.
324 *
325 * (*) fsconfig_set_string: A string value is specified. The parameter can be
326 * expecting boolean, integer, string or take a path. A conversion to an
327 * appropriate type will be attempted (which may include looking up as a
328 * path). @_value points to a NUL-terminated string and @aux must be 0.
329 *
330 * (*) fsconfig_set_binary: A binary blob is specified. @_value points to the
331 * blob and @aux indicates its size. The parameter must be expecting a
332 * blob.
333 *
334 * (*) fsconfig_set_path: A non-empty path is specified. The parameter must be
335 * expecting a path object. @_value points to a NUL-terminated string that
336 * is the path and @aux is a file descriptor at which to start a relative
337 * lookup or AT_FDCWD.
338 *
339 * (*) fsconfig_set_path_empty: As fsconfig_set_path, but with AT_EMPTY_PATH
340 * implied.
341 *
342 * (*) fsconfig_set_fd: An open file descriptor is specified. @_value must be
343 * NULL and @aux indicates the file descriptor.
344 */
345 SYSCALL_DEFINE5(fsconfig,
346 int, fd,
347 unsigned int, cmd,
348 const char __user *, _key,
349 const void __user *, _value,
350 int, aux)
351 {
352 struct fs_context *fc;
353 struct fd f;
354 int ret;
355 int lookup_flags = 0;
356
357 struct fs_parameter param = {
358 .type = fs_value_is_undefined,
359 };
360
361 if (fd < 0)
362 return -EINVAL;
363
364 switch (cmd) {
365 case FSCONFIG_SET_FLAG:
366 if (!_key || _value || aux)
367 return -EINVAL;
368 break;
369 case FSCONFIG_SET_STRING:
370 if (!_key || !_value || aux)
371 return -EINVAL;
372 break;
373 case FSCONFIG_SET_BINARY:
374 if (!_key || !_value || aux <= 0 || aux > 1024 * 1024)
375 return -EINVAL;
376 break;
377 case FSCONFIG_SET_PATH:
378 case FSCONFIG_SET_PATH_EMPTY:
379 if (!_key || !_value || (aux != AT_FDCWD && aux < 0))
380 return -EINVAL;
381 break;
382 case FSCONFIG_SET_FD:
383 if (!_key || _value || aux < 0)
384 return -EINVAL;
385 break;
386 case FSCONFIG_CMD_CREATE:
387 case FSCONFIG_CMD_CREATE_EXCL:
388 case FSCONFIG_CMD_RECONFIGURE:
389 if (_key || _value || aux)
390 return -EINVAL;
391 break;
392 default:
393 return -EOPNOTSUPP;
394 }
395
396 f = fdget(fd);
397 if (!f.file)
398 return -EBADF;
399 ret = -EINVAL;
400 if (f.file->f_op != &fscontext_fops)
401 goto out_f;
402
403 fc = f.file->private_data;
404 if (fc->ops == &legacy_fs_context_ops) {
405 switch (cmd) {
406 case FSCONFIG_SET_BINARY:
407 case FSCONFIG_SET_PATH:
408 case FSCONFIG_SET_PATH_EMPTY:
409 case FSCONFIG_SET_FD:
> 410 case FSCONFIG_CMD_CREATE_EXEC:
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-12 13:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-11 4:02 [PATCH -next] fsconfig: intercept for non-new mount API in advance for FSCONFIG_CMD_CREATE_EXCL Hongbo Li
2024-05-11 6:08 ` Hongbo Li
2024-05-12 13:12 ` kernel test robot
2024-05-12 13:25 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).