Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Take "sc_lock" after calling disk_ioctl() to make GP...



details:   https://anonhg.NetBSD.org/src/rev/4fe89874ae1e
branches:  trunk
changeset: 451517:4fe89874ae1e
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun May 26 10:22:07 2019 +0000

description:
Take "sc_lock" after calling disk_ioctl() to make GPT partitioning work.

diffstat:

 sys/dev/md.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r e0281d760f5b -r 4fe89874ae1e sys/dev/md.c
--- a/sys/dev/md.c      Sun May 26 10:21:33 2019 +0000
+++ b/sys/dev/md.c      Sun May 26 10:22:07 2019 +0000
@@ -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 @@
        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) {



Home | Main Index | Thread Index | Old Index