Re: [RFC PATCH] fs: call_usermodehelper_root helper introduced

From: Oleg Nesterov
Date: Wed May 22 2013 - 12:07:46 EST


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@xxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/