|
@@ -1452,6 +1452,22 @@ out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Function to update ctime/mtime for a given device path.
|
|
|
|
+ * Mainly used for ctime/mtime based probe like libblkid.
|
|
|
|
+ */
|
|
|
|
+static void update_dev_time(char *path_name)
|
|
|
|
+{
|
|
|
|
+ struct file *filp;
|
|
|
|
+
|
|
|
|
+ filp = filp_open(path_name, O_RDWR, 0);
|
|
|
|
+ if (!filp)
|
|
|
|
+ return;
|
|
|
|
+ file_update_time(filp);
|
|
|
|
+ filp_close(filp, NULL);
|
|
|
|
+ return;
|
|
|
|
+}
|
|
|
|
+
|
|
static int btrfs_rm_dev_item(struct btrfs_root *root,
|
|
static int btrfs_rm_dev_item(struct btrfs_root *root,
|
|
struct btrfs_device *device)
|
|
struct btrfs_device *device)
|
|
{
|
|
{
|
|
@@ -1704,10 +1720,14 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
|
|
|
|
|
|
ret = 0;
|
|
ret = 0;
|
|
|
|
|
|
- /* Notify udev that device has changed */
|
|
|
|
- if (bdev)
|
|
|
|
|
|
+ if (bdev) {
|
|
|
|
+ /* Notify udev that device has changed */
|
|
btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
|
|
btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
|
|
|
|
|
|
|
|
+ /* Update ctime/mtime for device path for libblkid */
|
|
|
|
+ update_dev_time(device_path);
|
|
|
|
+ }
|
|
|
|
+
|
|
error_brelse:
|
|
error_brelse:
|
|
brelse(bh);
|
|
brelse(bh);
|
|
if (bdev)
|
|
if (bdev)
|
|
@@ -2146,6 +2166,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
|
|
ret = btrfs_commit_transaction(trans, root);
|
|
ret = btrfs_commit_transaction(trans, root);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* Update ctime/mtime for libblkid */
|
|
|
|
+ update_dev_time(device_path);
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
error_trans:
|
|
error_trans:
|