From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [RFC PATCH] fs: call_usermodehelper_root helper introduced Date: Wed, 22 May 2013 18:03:53 +0200 Message-ID: <20130522160353.GB16571@redhat.com> References: <20130522072840.27720.85023.stgit@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: viro@zeniv.linux.org.uk, serge.hallyn@canonical.com, jlayton@redhat.com, lucas.demarchi@profusion.mobi, rusty@rustcorp.com.au, linux-kernel@vger.kernel.org, bfields@fieldses.org, ebiederm@xmission.com, bharrosh@panasas.com, linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, devel@openvz.org To: Stanislav Kinsbursky Return-path: Content-Disposition: inline In-Reply-To: <20130522072840.27720.85023.stgit@localhost.localdomain> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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