From patchwork Mon Mar 5 21:34:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 144777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id EE33EB6FA1 for ; Tue, 6 Mar 2012 08:35:20 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1S4fYf-0000ep-Fi; Mon, 05 Mar 2012 21:35:05 +0000 Received: from mail-pw0-f49.google.com ([209.85.160.49]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1S4fYd-0000ef-0s for kernel-team@lists.ubuntu.com; Mon, 05 Mar 2012 21:35:03 +0000 Received: by pbcun4 with SMTP id un4so901524pbc.8 for ; Mon, 05 Mar 2012 13:35:02 -0800 (PST) Received-SPF: pass (google.com: domain of rtg.canonical@gmail.com designates 10.68.219.130 as permitted sender) client-ip=10.68.219.130; Authentication-Results: mr.google.com; spf=pass (google.com: domain of rtg.canonical@gmail.com designates 10.68.219.130 as permitted sender) smtp.mail=rtg.canonical@gmail.com; dkim=pass header.i=rtg.canonical@gmail.com Received: from mr.google.com ([10.68.219.130]) by 10.68.219.130 with SMTP id po2mr53778425pbc.140.1330983302051 (num_hops = 1); Mon, 05 Mar 2012 13:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :content-type; bh=CFFKXcc5vE+J5N4kiZkhAMyz4YGiCqUfsTuEbk8c93I=; b=O7xZIg04M5bvle1L5TjS/JN7vW2wZERslseF0GXR8aPS6ZAMv4hH1icqZt8unCEneG FPjrGl85zqPNq1UgPJw9T0U8aj1TznAsbxcQlRCCvKKKZ8fkGA50eeCbcc7J3Oag1Xf1 ZtD13eDq4llKbpJU6bR+ISNU2Rf2z7YRyjjdlgmAki5ghJeXI/WmFMFAlQxVepnNbVET LFiCYsi5TKQBv8AQJbG3np1Wh6AvMi5UTPhBu37XVtTck1DEiLoeRfHkwvbK7T/CdMAS E43+9yNHBNAZYjTag80NJR9AgGapABaUj4uifBOBqNxR6Na/3uroXRjwc+UGxA/RPg+Z faug== Received: by 10.68.219.130 with SMTP id po2mr46056969pbc.140.1330983302023; Mon, 05 Mar 2012 13:35:02 -0800 (PST) Received: from [10.0.2.6] (host-174-45-43-11.hln-mt.client.bresnan.net. [174.45.43.11]) by mx.google.com with ESMTPS id x1sm14288461pbp.50.2012.03.05.13.34.59 (version=SSLv3 cipher=OTHER); Mon, 05 Mar 2012 13:35:01 -0800 (PST) Message-ID: <4F55317C.5070701@canonical.com> Date: Mon, 05 Mar 2012 14:34:52 -0700 From: Tim Gardner User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120302 Thunderbird/11.0 MIME-Version: 1.0 To: kernel-team Subject: SRU for Lucid/Maverick/Natty/Oneiric, bsg: fix sysfs link remove warning X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list Reply-To: tim.gardner@canonical.com List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Clean cherry-pick as far back as 2.6.32.y Acked-by: Colin Ian King From b6d997273d3250868df8b9f8e06aea8c6e2c614c Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Wed, 8 Feb 2012 20:02:03 +0100 Subject: [PATCH 2.6.32.y 3.0.y 3.2.y] bsg: fix sysfs link remove warning BugLink: http://bugs.launchpad.net/bugs/946928 We create "bsg" link if q->kobj.sd is not NULL, so remove it only when the same condition is true. Fixes: WARNING: at fs/sysfs/inode.c:323 sysfs_hash_and_remove+0x2b/0x77() sysfs: can not remove 'bsg', no directory Call Trace: [] warn_slowpath_common+0x6a/0x7f [] ? sysfs_hash_and_remove+0x2b/0x77 [] warn_slowpath_fmt+0x2b/0x2f [] sysfs_hash_and_remove+0x2b/0x77 [] sysfs_remove_link+0x20/0x23 [] bsg_unregister_queue+0x40/0x6d [] __scsi_remove_device+0x31/0x9d [] scsi_forget_host+0x41/0x52 [] scsi_remove_host+0x71/0xe0 [] quiesce_and_remove_host+0x51/0x83 [usb_storage] [] usb_stor_disconnect+0x18/0x22 [usb_storage] [] usb_unbind_interface+0x4e/0x109 [] __device_release_driver+0x6b/0xa6 [] device_release_driver+0x17/0x22 [] bus_remove_device+0xd6/0xe6 [] device_del+0xf2/0x137 [] usb_disable_device+0x94/0x1a0 Signed-off-by: Stanislaw Gruszka Signed-off-by: Jens Axboe (cherry picked from commit 37b40adf2d1b4a5e51323be73ccf8ddcf3f15dd3) Signed-off-by: Tim Gardner --- block/bsg.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/block/bsg.c b/block/bsg.c index 702f131..c0ab25c 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -985,7 +985,8 @@ void bsg_unregister_queue(struct request_queue *q) mutex_lock(&bsg_mutex); idr_remove(&bsg_minor_idr, bcd->minor); - sysfs_remove_link(&q->kobj, "bsg"); + if (q->kobj.sd) + sysfs_remove_link(&q->kobj, "bsg"); device_unregister(bcd->class_dev); bcd->class_dev = NULL; kref_put(&bcd->ref, bsg_kref_release_function); -- 1.7.9