Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754766AbaAGXT1 (ORCPT ); Tue, 7 Jan 2014 18:19:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41734 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753999AbaAGXTU (ORCPT ); Tue, 7 Jan 2014 18:19:20 -0500 Date: Tue, 7 Jan 2014 17:32:20 -0500 From: Mike Snitzer To: Mikulas Patocka , Greg Kroah-Hartman Cc: Linus Torvalds , Bart Van Assche , Jeff Mahoney , Linux Kernel Mailing List , device-mapper development , Thomas Gleixner , Paul McKenney , Ingo Molnar Subject: Re: kobject: provide kobject_put_wait to fix module unload race Message-ID: <20140107223220.GA20588@redhat.com> References: <52C98BCC.9040900@acm.org> <20140105182640.GA2522@kroah.com> <20140106213111.GA2536@redhat.com> <20140107191910.GA8884@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 07 2014 at 3:16pm -0500, Mikulas Patocka wrote: > On Tue, 7 Jan 2014, Mike Snitzer wrote: > > > I've staged your patch in linux-next for 3.14, see: > > http://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=af7b1e5c767fc895788c971c8f4686402ac8344f > > Looking at this patch, I realize that it is buggy too. If module unload > happens at this point (after the completion is signaled, but before the > release function returns), it crashes. > > static void dm_kobject_release(struct kobject *kobj) > { > complete(dm_get_completion_from_kobject(kobj)); > >========== module unload here ===============< > } That race isn't a surprise, thought you pointed it out earlier in this thread? Anyway, I'm inclined to keep the racey patch staged in linux-dm.git until the stalemate with gregkh is resolved. DM is no worse than other code that follows this same wait for completion pattern. > The patch that I sent initially in this thread doesn't have this bug > because the completion is signaled in non-module code. > > That goes back to my initial claim - it is impossible to use the kobject > interface correctly! But if Greg doesn't want a patch that fixes the > kobject interface, I don't really know what to do about it. Right, I'm missing what is wrong with your proposed kobject_put_wait interface. Greg, can you please establish that you understand the problem, and existing kobject patterns, before you dismiss a fix? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/