From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbcLJAPf (ORCPT ); Fri, 9 Dec 2016 19:15:35 -0500 Received: from mleia.com ([178.79.152.223]:58130 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750982AbcLJAPe (ORCPT ); Fri, 9 Dec 2016 19:15:34 -0500 From: Vladimir Zapolskiy To: Greg Kroah-Hartman , Rob Herring Cc: linux-kernel@vger.kernel.org Subject: [PATCH] driver core: flush async calls before testing driver removal Date: Sat, 10 Dec 2016 02:15:19 +0200 Message-Id: <20161210001519.24870-1-vz@mleia.com> X-Mailer: git-send-email 2.10.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20161210_001533_154656_28ACEE6C X-CRM114-Status: GOOD ( 11.64 ) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If CONFIG_DEBUG_TEST_DRIVER_REMOVE option is enabled a number of false positives are reported for ATA controller drivers, because ATA port probes are done asynchronously, and the same problem may also touch other asynchronously probed drivers. To reduce the rate of false reports on boot call async_synchronize_full() before attempting to remove a driver, the same is done in delete_module() syscall for all possible drivers and in __device_release_driver() function for asynchronously probed drivers. Fixes: bea5b158ff0d ("driver core: add test of driver remove calls during probe") Suggested-by: Tejun Heo Signed-off-by: Vladimir Zapolskiy --- Some time ago the issue was discussed on the linux-ide mailing list, see https://www.spinics.net/lists/linux-ide/msg53481.html drivers/base/dd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index d76cd97..a4feecf 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -384,6 +384,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) if (test_remove) { test_remove = false; + async_synchronize_full(); + if (dev->bus->remove) dev->bus->remove(dev); else if (drv->remove) -- 2.10.2