Take "sc_lock" after calling disk_ioctl() to make GPT partitioning work.
This commit is contained in:
parent
9add7bb543
commit
eeb3ed56d8
10
sys/dev/md.c
10
sys/dev/md.c
|
@ -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.
|
* Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_md.h"
|
#include "opt_md.h"
|
||||||
|
@ -479,21 +479,19 @@ mdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
||||||
if ((sc = device_lookup_private(&md_cd, MD_UNIT(dev))) == NULL)
|
if ((sc = device_lookup_private(&md_cd, MD_UNIT(dev))) == NULL)
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
mutex_enter(&sc->sc_lock);
|
|
||||||
if (sc->sc_type != MD_UNCONFIGURED) {
|
if (sc->sc_type != MD_UNCONFIGURED) {
|
||||||
error = disk_ioctl(&sc->sc_dkdev, dev, cmd, data, flag, l);
|
error = disk_ioctl(&sc->sc_dkdev, dev, cmd, data, flag, l);
|
||||||
if (error != EPASSTHROUGH) {
|
if (error != EPASSTHROUGH) {
|
||||||
mutex_exit(&sc->sc_lock);
|
return error;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is not the raw partition, punt! */
|
/* If this is not the raw partition, punt! */
|
||||||
if (DISKPART(dev) != RAW_PART) {
|
if (DISKPART(dev) != RAW_PART) {
|
||||||
mutex_exit(&sc->sc_lock);
|
|
||||||
return ENOTTY;
|
return ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex_enter(&sc->sc_lock);
|
||||||
umd = (struct md_conf *)data;
|
umd = (struct md_conf *)data;
|
||||||
error = EINVAL;
|
error = EINVAL;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
|
Loading…
Reference in New Issue