diff mbox

Btrfs: fix wrong uevent target

Message ID 1404291834-11113-1-git-send-email-miaox@cn.fujitsu.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Miao Xie July 2, 2014, 9:03 a.m. UTC
block_device's bd_disk points to the disk, not the object which block_device
is actually corresponding to(the whole disk or a partition), so we would send
uevent to the wrong target. Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Miao Xie July 3, 2014, 11:09 a.m. UTC | #1
CC Anand Jain

Sorry, please ignore this patch.
Anand wrote the same patch several days ago, so this bug fix belongs to Anand
though he NACKed his patch at that time.

Thanks
Miao

On Wed, 2 Jul 2014 17:03:54 +0800, Miao Xie wrote:
> block_device's bd_disk points to the disk, not the object which block_device
> is actually corresponding to(the whole disk or a partition), so we would send
> uevent to the wrong target. Fix it.
> 
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
>  fs/btrfs/volumes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 95828b0..e8b9214 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -123,7 +123,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,
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Mason July 3, 2014, 2 p.m. UTC | #2
On 07/03/2014 07:09 AM, Miao Xie wrote:
> CC Anand Jain
> 
> Sorry, please ignore this patch.
> Anand wrote the same patch several days ago, so this bug fix belongs to Anand
> though he NACKed his patch at that time.

It certainly looks right, but Anand had mentioned that he had a few
questions on testing.  I've pulled it out for now, but I'll take Anand's
version when you're both happy.

-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anand Jain July 3, 2014, 5:32 p.m. UTC | #3
Chris,

   This fix is theoretically correct but my guess that this would
   solve problem as reported by Qu Wenruo was wrong [1].
   Patch is good to integrate.

Thanks, Anand

[1] Re: [PATCH RFC] btrfs: Add ctime/mtime update for btrfs device 
add/remove.


On 03/07/2014 22:00, Chris Mason wrote:
> On 07/03/2014 07:09 AM, Miao Xie wrote:
>> CC Anand Jain
>>
>> Sorry, please ignore this patch.
>> Anand wrote the same patch several days ago, so this bug fix belongs to Anand
>> though he NACKed his patch at that time.
>
> It certainly looks right, but Anand had mentioned that he had a few
> questions on testing.  I've pulled it out for now, but I'll take Anand's
> version when you're both happy.
>
> -chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Qu Wenruo July 4, 2014, 1:58 a.m. UTC | #4
-------- Original Message --------
Subject: Re: [PATCH] Btrfs: fix wrong uevent target
From: Anand Jain <anand.jain@oracle.com>
To: Chris Mason <clm@fb.com>
Date: 2014?07?04? 01:32
> Chris,
>
>   This fix is theoretically correct but my guess that this would
>   solve problem as reported by Qu Wenruo was wrong [1].
>   Patch is good to integrate.
>
> Thanks, Anand
>
> [1] Re: [PATCH RFC] btrfs: Add ctime/mtime update for btrfs device 
> add/remove.
Yes, whatever uevent improvement will not solve the problem of 'btrfs 
dev scan; btrfs dev del; btrfs dev scan'.
Since uevent event is send from kernel and received by ueventd, then 
ueventd goes to update the device file ctime/mtine.
The uevent procedure is always asynchronized, so it will not fix the 
'btrfs dev scan' libblkid cache problem.

Althogh my RFC patch is ugly, it will provide a synchronzied method to 
update ctime/mtime from kernel.

Thank,
Qu
>
>
> On 03/07/2014 22:00, Chris Mason wrote:
>> On 07/03/2014 07:09 AM, Miao Xie wrote:
>>> CC Anand Jain
>>>
>>> Sorry, please ignore this patch.
>>> Anand wrote the same patch several days ago, so this bug fix belongs 
>>> to Anand
>>> though he NACKed his patch at that time.
>>
>> It certainly looks right, but Anand had mentioned that he had a few
>> questions on testing.  I've pulled it out for now, but I'll take Anand's
>> version when you're both happy.
>>
>> -chris
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Miao Xie July 4, 2014, 4:18 a.m. UTC | #5
On Fri, 4 Jul 2014 01:32:11 +0800, Anand Jain wrote:
> Chris,
> 
>   This fix is theoretically correct but my guess that this would
>   solve problem as reported by Qu Wenruo was wrong [1].
>   Patch is good to integrate.
> 
> Thanks, Anand
> 
> [1] Re: [PATCH RFC] btrfs: Add ctime/mtime update for btrfs device add/remove.

I have merged this patch(just change the changelog) and other important bug fix patches
into my tree to make it easier to be merged into Chris's for-linus branch. The URL is

  https://github.com/miaoxie/linux-btrfs.git for-3.16-rcX

But because there are some old patches in the current for-linus branch, if someone want to
merge my branch to for-linus, he/she must reset for-linus branch to

  commit 2aa06a35d06a34b3109bdbf1d653de1695dc8f12
  Author: Eric Sandeen <sandeen@redhat.com>
  Date:   Fri Jun 27 16:50:31 2014 -0500

    btrfs: fix nossd and ssd_spread mount option regression

then can pull my branch and merge it into for-linus branch directly.

Thanks
Miao

> On 03/07/2014 22:00, Chris Mason wrote:
>> On 07/03/2014 07:09 AM, Miao Xie wrote:
>>> CC Anand Jain
>>>
>>> Sorry, please ignore this patch.
>>> Anand wrote the same patch several days ago, so this bug fix belongs to Anand
>>> though he NACKed his patch at that time.
>>
>> It certainly looks right, but Anand had mentioned that he had a few
>> questions on testing.  I've pulled it out for now, but I'll take Anand's
>> version when you're both happy.
>>
>> -chris
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 95828b0..e8b9214 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -123,7 +123,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,