]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - fs/btrfs/volumes.c
btrfs: Notify udev when removing device
[~shefty/rdma-dev.git] / fs / btrfs / volumes.c
index 0b1b7e22e7eabd06f97a894fae28f82cbb59e886..886f4ba0f71dbf334dd670f8f4175e2ad1474f30 100644 (file)
@@ -72,6 +72,19 @@ static void free_fs_devices(struct btrfs_fs_devices *fs_devices)
        kfree(fs_devices);
 }
 
+static void btrfs_kobject_uevent(struct block_device *bdev,
+                                enum kobject_action action)
+{
+       int ret;
+
+       ret = kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, action);
+       if (ret)
+               pr_warn("Sending event '%d' to kobject: '%s' (%p): failed\n",
+                       action,
+                       kobject_name(&disk_to_dev(bdev->bd_disk)->kobj),
+                       &disk_to_dev(bdev->bd_disk)->kobj);
+}
+
 void btrfs_cleanup_fs_uuids(void)
 {
        struct btrfs_fs_devices *fs_devices;
@@ -1542,6 +1555,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
 
        ret = 0;
 
+       /* Notify udev that device has changed */
+       btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
+
 error_brelse:
        brelse(bh);
        if (bdev)