Fix lvm lvrename command. There was bug in dm_dev_lookup where

dm_dev_lookup_name was called with device uuid. Remove dm_dev_t:dk_label is
it not used anymore.
This commit is contained in:
haad 2009-03-06 16:17:29 +00:00
parent 08d9a1067c
commit 50b5b59cc7
2 changed files with 13 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dm.h,v 1.10 2009/03/01 23:15:56 haad Exp $ */ /* $NetBSD: dm.h,v 1.11 2009/03/06 16:17:29 haad Exp $ */
/* /*
* Copyright (c) 2008 The NetBSD Foundation, Inc. * Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -43,6 +43,8 @@
#include <sys/rwlock.h> #include <sys/rwlock.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/disklabel.h>
#define DM_MAX_TYPE_NAME 16 #define DM_MAX_TYPE_NAME 16
#define DM_NAME_LEN 128 #define DM_NAME_LEN 128
#define DM_UUID_LEN 129 #define DM_UUID_LEN 129
@ -130,7 +132,6 @@ typedef struct dm_dev {
struct dm_dev_head upcalls; struct dm_dev_head upcalls;
struct disklabel *dk_label; /* Disklabel for this table. */
struct disk *diskp; struct disk *diskp;
TAILQ_ENTRY(dm_dev) next_upcall; /* LIST of mirrored, snapshoted devices. */ TAILQ_ENTRY(dm_dev) next_upcall; /* LIST of mirrored, snapshoted devices. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: dm_dev.c,v 1.2 2008/12/19 15:24:03 haad Exp $ */ /* $NetBSD: dm_dev.c,v 1.3 2009/03/06 16:17:29 haad Exp $ */
/* /*
* Copyright (c) 2008 The NetBSD Foundation, Inc. * Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -32,6 +32,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/disk.h>
#include <sys/disklabel.h> #include <sys/disklabel.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/ioccom.h> #include <sys/ioccom.h>
@ -89,7 +90,7 @@ dm_dev_lookup(const char *dm_dev_name, const char *dm_dev_uuid,
} }
if (dm_dev_uuid != NULL) if (dm_dev_uuid != NULL)
if ((dmv = dm_dev_lookup_name(dm_dev_uuid)) != NULL){ if ((dmv = dm_dev_lookup_uuid(dm_dev_uuid)) != NULL){
dm_dev_busy(dmv); dm_dev_busy(dmv);
mutex_exit(&dm_dev_mutex); mutex_exit(&dm_dev_mutex);
return dmv; return dmv;
@ -304,8 +305,10 @@ dm_dev_alloc()
dm_dev_t *dmv; dm_dev_t *dmv;
dmv = kmem_zalloc(sizeof(dm_dev_t), KM_NOSLEEP); dmv = kmem_zalloc(sizeof(dm_dev_t), KM_NOSLEEP);
dmv->dk_label = kmem_zalloc(sizeof(struct disklabel), KM_NOSLEEP);
if(dmv != NULL)
dmv->diskp = kmem_zalloc(sizeof(struct disk), KM_NOSLEEP);
return dmv; return dmv;
} }
@ -316,9 +319,9 @@ int
dm_dev_free(dm_dev_t *dmv) dm_dev_free(dm_dev_t *dmv)
{ {
KASSERT(dmv != NULL); KASSERT(dmv != NULL);
if (dmv->dk_label != NULL) if(dmv->diskp != NULL)
(void)kmem_free(dmv->dk_label, sizeof(struct disklabel)); (void)kmem_free(dmv->diskp, sizeof(struct disk));
(void)kmem_free(dmv, sizeof(dm_dev_t)); (void)kmem_free(dmv, sizeof(dm_dev_t));