[Devel] [RFC PATCH] fs: call_usermodehelper_root helper introduced

Oleg Nesterov oleg at redhat.com
Wed May 22 09:03:53 PDT 2013


On 05/22, Stanislav Kinsbursky wrote:
>
> +static int umh_set_fs_root(struct subprocess_info *info, struct cred *new)
> +{
> +	set_fs_root(current->fs, info->data);
> +	return 0;
> +}
> +
> +/*
> + * Call a usermode helper with a specific fs root.
> + *
> + * The caller must hold extra reference to it otherwise, because it will be
> + * put on usermodehelper thread exit.
> + */
> +int call_usermodehelper_root(char *path, char **argv, char **envp,
> +			     struct path *root, int wait)
> +{
> +	struct subprocess_info *info;
> +	gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
> +
> +	info = call_usermodehelper_setup(path, argv, envp, gfp_mask,
> +					      umh_set_fs_root, NULL, root);
> +	if (info == NULL)
> +		return -ENOMEM;
> +
> +	return call_usermodehelper_exec(info, wait);
> +}
> +EXPORT_SYMBOL(call_usermodehelper_root);

Of course, I can't ack the placement (and yes, it was me who argued
that kmod.c is probably not the best place), but the patch looks fine.

I am not sure the new helper actually needs "int wait" but this matches
call_usermodehelper().

For what it's worth:

Reviewed-by: Oleg Nesterov <oleg at redhat.com>




More information about the Devel mailing list