summaryrefslogtreecommitdiff
path: root/sys/dev/dm/device-mapper.c
diff options
context:
space:
mode:
authorhaad <haad@NetBSD.org>2009-12-29 23:37:47 +0000
committerhaad <haad@NetBSD.org>2009-12-29 23:37:47 +0000
commit36fe06980c4de693c4e63ba30ee873aed0ffdb2a (patch)
tree906fe69a97a881b567a79d8475aef82f22cfa366 /sys/dev/dm/device-mapper.c
parent35ea637d2bf4404c222f8ef069227516d1135ba1 (diff)
Add private lock to dm_dev_t used for mutual exclusion for diks(9) api
routines. This change fixes PR kern/42532.
Diffstat (limited to 'sys/dev/dm/device-mapper.c')
-rw-r--r--sys/dev/dm/device-mapper.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/dev/dm/device-mapper.c b/sys/dev/dm/device-mapper.c
index 57331c137a0..99777a0679a 100644
--- a/sys/dev/dm/device-mapper.c
+++ b/sys/dev/dm/device-mapper.c
@@ -1,4 +1,4 @@
-/* $NetBSD: device-mapper.c,v 1.10 2009/12/06 14:33:46 haad Exp $ */
+/* $NetBSD: device-mapper.c,v 1.11 2009/12/29 23:37:47 haad Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -402,8 +402,13 @@ dmstrategy(struct buf *bp)
return;
}
- /* FIXME: have to be called with IPL_BIO*/
+ /*
+ * disk(9) is part of device structure and it can't be used without
+ * mutual exclusion, use diskp_mtx until it will be fixed.
+ */
+ mutex_enter(&dmv->diskp_mtx);
disk_busy(dmv->diskp);
+ mutex_exit(&dmv->diskp_mtx);
/* Select active table */
tbl = dm_table_get_entry(&dmv->table_head, DM_TABLE_ACTIVE);
@@ -459,9 +464,10 @@ dmstrategy(struct buf *bp)
if (issued_len < buf_len)
nestiobuf_done(bp, buf_len - issued_len, EINVAL);
- /* FIXME have to be called with SPL_BIO*/
+ mutex_enter(&dmv->diskp_mtx);
disk_unbusy(dmv->diskp, buf_len, bp != NULL ? bp->b_flags & B_READ : 0);
-
+ mutex_exit(&dmv->diskp_mtx);
+
dm_table_release(&dmv->table_head, DM_TABLE_ACTIVE);
dm_dev_unbusy(dmv);