From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [RFC 4/4] {RFC} kmod.c: Add new call_usermodehelper_timeout() API Date: Fri, 23 Mar 2012 14:34:04 +0100 Message-ID: <20120323133404.GA9095@redhat.com> References: <4F691059.30405@panasas.com> <4F691383.5040506@panasas.com> <4F6A92FC.6060702@panasas.com> <20120322142758.GA12370@redhat.com> <4F6B789C.8020201@panasas.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andrew Morton , Tetsuo Handa , "Rafael J. Wysocki" , keyrings-6DNke4IJHB0gsBAKwltoeQ@public.gmane.org, linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel , linux-kernel , NFS list , Trond Myklebust , "Bhamare, Sachin" , David Howells , Eric Paris , "Srivatsa S. Bhat" , Kay Sievers , James Morris , "Eric W. Biederman" , Greg KH , Rusty Russell , Tejun Heo , David Rientjes To: Boaz Harrosh Return-path: Content-Disposition: inline In-Reply-To: <4F6B789C.8020201-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org> Sender: linux-nfs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org On 03/22, Boaz Harrosh wrote: > > On 03/22/2012 07:27 AM, Oleg Nesterov wrote: > >> > >> usermodehelper: implement UMH_KILLABLE > >> > >> Implement UMH_KILLABLE, should be used along with UMH_WAIT_EXEC/PROC. The > >> caller must ensure that subprocess_info->path/etc can not go away until > >> call_usermodehelper_freeinfo(). > >> ... > >> > >> I think that my patch above does a much better/cleaner lifetime management of the > >> subprocess_info struct, with the use of a kref. > > > > This is subjective, you know ;) I specially tried to avoid the > > refcounting. > > > > Why? > > The all kref_ abstraction comes to a simple atomic_inc/dec. Again, this is subjective, but kref_ looks like the unnecessary complication to me. But I won't insist, see below. > > In any case. I do not know why do we need timeout, but this is > > orthogonal to KILLABLE. Please redo your patches on top of -mm > > tree? Please note that in this case the change becomes trivial. > > > > Yes you are right. OK, good. > > Hmm. For example, exit_mm() does xchg(). > > > > Again, Personally I like xchg, but not here, not for an object > life-time management. Two threads share a structure, that needs > to go when the last one ends. And xchg(info->complete) implements the simplest counter, xchg() == NULL is equivalent to atomic_dec_and_test() == T. But again, again, I won't argue if you send the patch which uses kref_ instead. I do not maintain this code and I do not really mind. And I never pretended my taste is good ;) My point is, this is completely orthogonal to "add the timeout", and if you want to change the refcounting I'd suggest a separate patch. What we need is wait_for_completion_state_timeout() to avoid the horror like if (UMH_KILLABLE && !timeout) wait_for_completion_killable(...); else if (UMH_KILLABLE && timeout) wait_for_completion_killable_timeout(...); else if (!UMH_KILLABLE && !timeout) ... IOW, I think we need to export wait_for_common() first. This is the only complication afaics. After that "add the timeout" becomes almost one-liner, with or without "switch to kref_". > Is there an mm git tree? No, afaik > random linux-next/master point. Which should do the job. Yes, I think this should work. Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html