Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-localcount]: src/sys/dev When we spawn a new unit, make sure we...
details: https://anonhg.NetBSD.org/src/rev/cab4ab0c4b5d
branches: pgoyette-localcount
changeset: 852873:cab4ab0c4b5d
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Wed Jul 27 11:23:32 2016 +0000
description:
When we spawn a new unit, make sure we get a pointer to its device_t so
we have something to give device_release() when we're finished!
Also, add a call to device_release() in an error path.
diffstat:
sys/dev/vnd.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diffs (41 lines):
diff -r bab66438a9c4 -r cab4ab0c4b5d sys/dev/vnd.c
--- a/sys/dev/vnd.c Wed Jul 27 03:25:00 2016 +0000
+++ b/sys/dev/vnd.c Wed Jul 27 11:23:32 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vnd.c,v 1.256.2.7 2016/07/26 05:54:39 pgoyette Exp $ */
+/* $NetBSD: vnd.c,v 1.256.2.8 2016/07/27 11:23:32 pgoyette Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.7 2016/07/26 05:54:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.8 2016/07/27 11:23:32 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vnd.h"
@@ -359,12 +359,21 @@
if (sc == NULL)
return ENOMEM;
+ /*
+ * get a pointer to the new device_t; we don't need
+ * need to _acquire() it, since vnd_spawn() will
+ * already have taken a reference.
+ */
+ self = device_lookup(&vnd_cd, unit);
+
/* compatibility, keep disklabel after close */
sc->sc_flags = VNF_KLABEL;
}
- if ((error = vndlock(sc)) != 0)
+ if ((error = vndlock(sc)) != 0) {
+ device_release(self);
return error;
+ }
mutex_enter(&sc->sc_dkdev.dk_openlock);
Home |
Main Index |
Thread Index |
Old Index