From patchwork Fri May 30 07:50:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 4268961 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 958869F333 for ; Fri, 30 May 2014 07:48:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1CA5202F8 for ; Fri, 30 May 2014 07:48:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C51F7201BC for ; Fri, 30 May 2014 07:48:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754863AbaE3HsL (ORCPT ); Fri, 30 May 2014 03:48:11 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:18590 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753109AbaE3HsK (ORCPT ); Fri, 30 May 2014 03:48:10 -0400 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s4U7m1QL031213 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 30 May 2014 07:48:02 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s4U7m01E016812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 30 May 2014 07:48:01 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s4U7m0qX018200; Fri, 30 May 2014 07:48:00 GMT Received: from wish.sg.oracle.com (/10.186.101.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 30 May 2014 00:47:59 -0700 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz, quwenruo@cn.fujitsu.com, clm@fb.com Subject: [PATCH] btrfs: kobject_uevent should use bd_part instead of bd_disk Date: Fri, 30 May 2014 15:50:59 +0800 Message-Id: <1401436259-17647-1-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 1.8.3.2 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Anand Jain reproducer 1: mkfs.btrfs -L test /dev/sdg1 mount LABEL=test /btrfs btrfs dev add /dev/sdg2 /btrfs btrfs dev del /dev/sdg1 /btrfs umount /btrfs mount LABEL=test /btrfs mount: special device LABEL-test1 does not exist It does not reproduce this problem when whole disk is used. And when newer kernel is used not sure what change in udev is doing the trick. But in any case reproducer2 below is more compelling. reproducer 2: btrfs dev del /dev/sdh2 /btrfs ls -l /dev/sdh1 /dev/sdh2 /dev/sdh3 mtime of deleted disk is stale. Fix it by providing bd_part for the kobject_uevent(). I have tested to confirm it doesn't break on the same thing when whole disk is used. Reported-by: Qu Wenruo Reported-by: Tsutomu Itoh Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f58ea9e..1aba687 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -124,7 +124,7 @@ static void btrfs_kobject_uevent(struct block_device *bdev, { int ret; - ret = kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, action); + ret = kobject_uevent(&part_to_dev(bdev->bd_part)->kobj, action); if (ret) pr_warn("BTRFS: Sending event '%d' to kobject: '%s' (%p): failed\n", action,