aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-ioctl.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2010-03-05 21:32:31 -0500
committerAlasdair G Kergon <agk@redhat.com>2010-03-05 21:32:31 -0500
commit3abf85b5b5851b5f28d3d8a920ebb844edd08352 (patch)
treeb59e5c9322cc116b0ce5dc183d3b8286080c6031 /drivers/md/dm-ioctl.c
parenta97f925a32aad2a37971d7bfb657006acf04e42d (diff)
dm ioctl: introduce flag indicating uevent was generated
Set a new DM_UEVENT_GENERATED_FLAG when returning from ioctls to indicate that a uevent was actually generated. This tells the userspace caller that it may need to wait for the event to be processed. Signed-off-by: Peter Rajnoha <prajnoha@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-ioctl.c')
-rw-r--r--drivers/md/dm-ioctl.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index e3cf5686d0aa..d7500e1c26f2 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -285,7 +285,8 @@ retry:
285 up_write(&_hash_lock); 285 up_write(&_hash_lock);
286} 286}
287 287
288static int dm_hash_rename(uint32_t cookie, const char *old, const char *new) 288static int dm_hash_rename(uint32_t cookie, uint32_t *flags, const char *old,
289 const char *new)
289{ 290{
290 char *new_name, *old_name; 291 char *new_name, *old_name;
291 struct hash_cell *hc; 292 struct hash_cell *hc;
@@ -344,7 +345,8 @@ static int dm_hash_rename(uint32_t cookie, const char *old, const char *new)
344 dm_table_put(table); 345 dm_table_put(table);
345 } 346 }
346 347
347 dm_kobject_uevent(hc->md, KOBJ_CHANGE, cookie); 348 if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, cookie))
349 *flags |= DM_UEVENT_GENERATED_FLAG;
348 350
349 dm_put(hc->md); 351 dm_put(hc->md);
350 up_write(&_hash_lock); 352 up_write(&_hash_lock);
@@ -736,10 +738,10 @@ static int dev_remove(struct dm_ioctl *param, size_t param_size)
736 __hash_remove(hc); 738 __hash_remove(hc);
737 up_write(&_hash_lock); 739 up_write(&_hash_lock);
738 740
739 dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr); 741 if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr))
742 param->flags |= DM_UEVENT_GENERATED_FLAG;
740 743
741 dm_put(md); 744 dm_put(md);
742 param->data_size = 0;
743 return 0; 745 return 0;
744} 746}
745 747
@@ -773,7 +775,9 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size)
773 return r; 775 return r;
774 776
775 param->data_size = 0; 777 param->data_size = 0;
776 return dm_hash_rename(param->event_nr, param->name, new_name); 778
779 return dm_hash_rename(param->event_nr, &param->flags, param->name,
780 new_name);
777} 781}
778 782
779static int dev_set_geometry(struct dm_ioctl *param, size_t param_size) 783static int dev_set_geometry(struct dm_ioctl *param, size_t param_size)
@@ -899,8 +903,8 @@ static int do_resume(struct dm_ioctl *param)
899 903
900 if (dm_suspended_md(md)) { 904 if (dm_suspended_md(md)) {
901 r = dm_resume(md); 905 r = dm_resume(md);
902 if (!r) 906 if (!r && !dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr))
903 dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr); 907 param->flags |= DM_UEVENT_GENERATED_FLAG;
904 } 908 }
905 909
906 if (old_map) 910 if (old_map)
@@ -1477,6 +1481,7 @@ static int validate_params(uint cmd, struct dm_ioctl *param)
1477{ 1481{
1478 /* Always clear this flag */ 1482 /* Always clear this flag */
1479 param->flags &= ~DM_BUFFER_FULL_FLAG; 1483 param->flags &= ~DM_BUFFER_FULL_FLAG;
1484 param->flags &= ~DM_UEVENT_GENERATED_FLAG;
1480 1485
1481 /* Ignores parameters */ 1486 /* Ignores parameters */
1482 if (cmd == DM_REMOVE_ALL_CMD || 1487 if (cmd == DM_REMOVE_ALL_CMD ||