Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932635Ab2EVAf1 (ORCPT ); Mon, 21 May 2012 20:35:27 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51343 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756800Ab2EVAfZ convert rfc822-to-8bit (ORCPT ); Mon, 21 May 2012 20:35:25 -0400 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 22 May 2012 08:35:21 +0800 Message-ID: Subject: =?UTF-8?Q?Re=3A_Race_condition_between_driver=5Fprobe=5Fdevice_and_d?= =?UTF-8?Q?evice=5Fshutdown=E2=80=8F?= From: Ming Lei To: Alan Stern Cc: Greg KH , Wedson Almeida Filho , Andrew Morton , linux-kernel@vger.kernel.org, Linux PM List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1382 Lines: 35 On Tue, May 22, 2012 at 2:29 AM, Alan Stern wrote: > On Mon, 21 May 2012, Ming Lei wrote: >> Another candidate fix is to register a reboot notifier in driver core to prevent >> driver from being bound or unbound from start of reboot/shutdown, but looks >> not easy as the way of holding device locks. > > I'd guess it was done this way so that the shutdown task wouldn't have > to wait for a buggy driver that didn't want to release the device lock > (or that crashed while holding the lock). Maybe, so I understand you agree on adding the device lock as did in the patch, don't I? Also we can add below line before acquiring device lock to help toubleshoot buggy driver. dev_dbg(dev, "acquiring device lock for shutdown\n"); > > It's not clear that the reboot notifier approach would work. ?What > about probes that had already started when notifier was called? Looks holding device lock is still needed in the notifier callback for handling the case if reboot notifier approach is taken. IMO, the way of holding device lock is better than reboot notifier approach. Thanks, -- Ming Lei -- 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/