From patchwork Tue May 18 13:48:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rajnoha X-Patchwork-Id: 100492 X-Patchwork-Delegate: agk@redhat.com Received: from mx02.colomx.prod.int.phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4IDqTtJ026897 for ; Tue, 18 May 2010 13:53:05 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx02.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4IDnTVN013576; Tue, 18 May 2010 09:49:30 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4IDnSMF013935 for ; Tue, 18 May 2010 09:49:28 -0400 Received: from alatyr.brq.redhat.com (alatyr.brq.redhat.com [10.34.28.125]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4IDnM1p027653; Tue, 18 May 2010 09:49:22 -0400 Message-ID: <4BF29AC0.7060208@redhat.com> Date: Tue, 18 May 2010 15:48:48 +0200 From: Peter Rajnoha User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 MIME-Version: 1.0 To: device-mapper development References: <4BC4894A.2090306@redhat.com> In-Reply-To: <4BC4894A.2090306@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-loop: dm-devel@redhat.com Cc: Alasdair G Kergon Subject: Re: [dm-devel] [PATCH] dm-ioctl: Return data to userspace after rename ioctl is processed X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 18 May 2010 13:53:05 +0000 (UTC) diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index d7500e1..f67ec28 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -49,6 +49,7 @@ struct vers_iter { static struct list_head _name_buckets[NUM_BUCKETS]; static struct list_head _uuid_buckets[NUM_BUCKETS]; +static int __dev_status(struct mapped_device *md, struct dm_ioctl *param); static void dm_hash_remove_all(int keep_open_devices); /* @@ -285,12 +286,12 @@ retry: up_write(&_hash_lock); } -static int dm_hash_rename(uint32_t cookie, uint32_t *flags, const char *old, - const char *new) +static int dm_hash_rename(struct dm_ioctl *param, const char *new) { char *new_name, *old_name; struct hash_cell *hc; struct dm_table *table; + int r; /* * duplicate new. @@ -307,7 +308,7 @@ static int dm_hash_rename(uint32_t cookie, uint32_t *flags, const char *old, hc = __get_name_cell(new); if (hc) { DMWARN("asked to rename to an already existing name %s -> %s", - old, new); + param->name, new); dm_put(hc->md); up_write(&_hash_lock); kfree(new_name); @@ -317,10 +318,10 @@ static int dm_hash_rename(uint32_t cookie, uint32_t *flags, const char *old, /* * Is there such a device as 'old' ? */ - hc = __get_name_cell(old); + hc = __get_name_cell(param->name); if (!hc) { DMWARN("asked to rename a non existent device %s -> %s", - old, new); + param->name, new); up_write(&_hash_lock); kfree(new_name); return -ENXIO; @@ -345,13 +346,15 @@ static int dm_hash_rename(uint32_t cookie, uint32_t *flags, const char *old, dm_table_put(table); } - if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, cookie)) - *flags |= DM_UEVENT_GENERATED_FLAG; + if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, param->event_nr)) + param->flags |= DM_UEVENT_GENERATED_FLAG; + + r = __dev_status(hc->md, param); dm_put(hc->md); up_write(&_hash_lock); kfree(old_name); - return 0; + return r; } /*----------------------------------------------------------------- @@ -774,10 +777,7 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size) if (r) return r; - param->data_size = 0; - - return dm_hash_rename(param->event_nr, ¶m->flags, param->name, - new_name); + return dm_hash_rename(param, new_name); } static int dev_set_geometry(struct dm_ioctl *param, size_t param_size)