aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 36142e947ffc..a9210bb594e7 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -24,6 +24,13 @@
24 24
25#define DM_MSG_PREFIX "core" 25#define DM_MSG_PREFIX "core"
26 26
27/*
28 * Cookies are numeric values sent with CHANGE and REMOVE
29 * uevents while resuming, removing or renaming the device.
30 */
31#define DM_COOKIE_ENV_VAR_NAME "DM_COOKIE"
32#define DM_COOKIE_LENGTH 24
33
27static const char *_name = DM_NAME; 34static const char *_name = DM_NAME;
28 35
29static unsigned int major = 0; 36static unsigned int major = 0;
@@ -1731,11 +1738,7 @@ int dm_resume(struct mapped_device *md)
1731 clear_bit(DMF_SUSPENDED, &md->flags); 1738 clear_bit(DMF_SUSPENDED, &md->flags);
1732 1739
1733 dm_table_unplug_all(map); 1740 dm_table_unplug_all(map);
1734
1735 dm_kobject_uevent(md);
1736
1737 r = 0; 1741 r = 0;
1738
1739out: 1742out:
1740 dm_table_put(map); 1743 dm_table_put(map);
1741 mutex_unlock(&md->suspend_lock); 1744 mutex_unlock(&md->suspend_lock);
@@ -1746,9 +1749,19 @@ out:
1746/*----------------------------------------------------------------- 1749/*-----------------------------------------------------------------
1747 * Event notification. 1750 * Event notification.
1748 *---------------------------------------------------------------*/ 1751 *---------------------------------------------------------------*/
1749void dm_kobject_uevent(struct mapped_device *md) 1752void dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,
1753 unsigned cookie)
1750{ 1754{
1751 kobject_uevent(&disk_to_dev(md->disk)->kobj, KOBJ_CHANGE); 1755 char udev_cookie[DM_COOKIE_LENGTH];
1756 char *envp[] = { udev_cookie, NULL };
1757
1758 if (!cookie)
1759 kobject_uevent(&disk_to_dev(md->disk)->kobj, action);
1760 else {
1761 snprintf(udev_cookie, DM_COOKIE_LENGTH, "%s=%u",
1762 DM_COOKIE_ENV_VAR_NAME, cookie);
1763 kobject_uevent_env(&disk_to_dev(md->disk)->kobj, action, envp);
1764 }
1752} 1765}
1753 1766
1754uint32_t dm_next_uevent_seq(struct mapped_device *md) 1767uint32_t dm_next_uevent_seq(struct mapped_device *md)