Module Name: src
Committed By: hannken
Date: Sun May 26 10:22:07 UTC 2019
Modified Files:
src/sys/dev: md.c
Log Message:
Take "sc_lock" after calling disk_ioctl() to make GPT partitioning work.
To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/md.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/md.c
diff -u src/sys/dev/md.c:1.80 src/sys/dev/md.c:1.81
--- src/sys/dev/md.c:1.80 Sat Mar 3 19:26:12 2018
+++ src/sys/dev/md.c Sun May 26 10:22:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.80 2018/03/03 19:26:12 christos Exp $ */
+/* $NetBSD: md.c,v 1.81 2019/05/26 10:22:07 hannken Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.80 2018/03/03 19:26:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.81 2019/05/26 10:22:07 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_md.h"
@@ -479,21 +479,19 @@ mdioctl(dev_t dev, u_long cmd, void *dat
if ((sc = device_lookup_private(&md_cd, MD_UNIT(dev))) == NULL)
return ENXIO;
- mutex_enter(&sc->sc_lock);
if (sc->sc_type != MD_UNCONFIGURED) {
error = disk_ioctl(&sc->sc_dkdev, dev, cmd, data, flag, l);
if (error != EPASSTHROUGH) {
- mutex_exit(&sc->sc_lock);
- return 0;
+ return error;
}
}
/* If this is not the raw partition, punt! */
if (DISKPART(dev) != RAW_PART) {
- mutex_exit(&sc->sc_lock);
return ENOTTY;
}
+ mutex_enter(&sc->sc_lock);
umd = (struct md_conf *)data;
error = EINVAL;
switch (cmd) {