Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Fix locking error.
details: https://anonhg.NetBSD.org/src/rev/95c4f9fa1b59
branches: trunk
changeset: 335232:95c4f9fa1b59
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Tue Dec 30 19:11:05 2014 +0000
description:
Fix locking error.
Clear EPASSTHROUGH return value from disk_ioctl.
Add missing wedge ioctls.
diffstat:
sys/dev/ccd.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 56 insertions(+), 13 deletions(-)
diffs (146 lines):
diff -r 435b88495acd -r 95c4f9fa1b59 sys/dev/ccd.c
--- a/sys/dev/ccd.c Tue Dec 30 18:57:36 2014 +0000
+++ b/sys/dev/ccd.c Tue Dec 30 19:11:05 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.156 2014/12/30 12:42:16 jnemeth Exp $ */
+/* $NetBSD: ccd.c,v 1.157 2014/12/30 19:11:05 mlelstv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.156 2014/12/30 12:42:16 jnemeth Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.157 2014/12/30 19:11:05 mlelstv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -1128,6 +1128,10 @@
case CCDIOCCLR:
case DIOCSDINFO:
case DIOCWDINFO:
+ case DIOCCACHESYNC:
+ case DIOCAWEDGE:
+ case DIOCDWEDGE:
+ case DIOCMWEDGES:
#ifdef __HAVE_OLD_DISKLABEL
case ODIOCSDINFO:
case ODIOCWDINFO:
@@ -1145,6 +1149,10 @@
case CCDIOCCLR:
case DIOCGDINFO:
case DIOCCACHESYNC:
+ case DIOCAWEDGE:
+ case DIOCDWEDGE:
+ case DIOCLWEDGES:
+ case DIOCMWEDGES:
case DIOCSDINFO:
case DIOCWDINFO:
case DIOCGPART:
@@ -1167,6 +1175,7 @@
if (error != EPASSTHROUGH)
goto out;
+ error = 0;
switch (cmd) {
case CCDIOCSET:
if (cs->sc_flags & CCDF_INITED) {
@@ -1252,8 +1261,6 @@
bufq_free(cs->sc_bufq);
goto out;
}
- disk_set_info(NULL, &cs->sc_dkdev, NULL);
- dkwedge_discover(&cs->sc_dkdev);
/* We can free the temporary variables now. */
kmem_free(vpp, ccio->ccio_ndisks * sizeof(*vpp));
@@ -1271,7 +1278,12 @@
/* Try and read the disklabel. */
ccdgetdisklabel(dev);
- break;
+ disk_set_info(NULL, &cs->sc_dkdev, NULL);
+
+ /* discover wedges */
+ mutex_exit(&cs->sc_dvlock);
+ dkwedge_discover(&cs->sc_dkdev);
+ return 0;
case CCDIOCCLR:
/*
@@ -1288,6 +1300,9 @@
goto out;
}
+ /* Delete all of our wedges. */
+ dkwedge_delall(&cs->sc_dkdev);
+
/* Stop new I/O, wait for in-flight I/O to complete. */
mutex_enter(cs->sc_iolock);
cs->sc_flags &= ~(CCDF_INITED|CCDF_VLABEL);
@@ -1337,7 +1352,6 @@
aprint_normal("%s: detached\n", cs->sc_xname);
/* Detach the disk. */
- dkwedge_delall(&cs->sc_dkdev);
disk_detach(&cs->sc_dkdev);
bufq_free(cs->sc_bufq);
ccdput(cs);
@@ -1365,13 +1379,6 @@
case DIOCCACHESYNC:
/*
- * XXX Do we really need to care about having a writable
- * file descriptor here?
- */
- if ((flag & FWRITE) == 0)
- return (EBADF);
-
- /*
* We pass this call down to all components and report
* the first error we encounter.
*/
@@ -1383,6 +1390,42 @@
}
break;
+ case DIOCAWEDGE:
+ {
+ struct dkwedge_info *dkw = (void *) data;
+
+ /* If the ioctl happens here, the parent is us. */
+ strlcpy(dkw->dkw_parent, cs->sc_xname,
+ sizeof(dkw->dkw_parent));
+ error = dkwedge_add(dkw);
+ break;
+ }
+
+ case DIOCDWEDGE:
+ {
+ struct dkwedge_info *dkw = (void *) data;
+
+ /* If the ioctl happens here, the parent is us. */
+ strlcpy(dkw->dkw_parent, cs->sc_xname,
+ sizeof(dkw->dkw_parent));
+ error = dkwedge_del(dkw);
+ break;
+ }
+
+ case DIOCLWEDGES:
+ {
+ struct dkwedge_list *dkwl = (void *) data;
+
+ error = dkwedge_list(&cs->sc_dkdev, dkwl, l);
+ break;
+ }
+
+ case DIOCMWEDGES:
+ {
+ dkwedge_discover(&cs->sc_dkdev);
+ break;
+ }
+
case DIOCWDINFO:
case DIOCSDINFO:
#ifdef __HAVE_OLD_DISKLABEL
Home |
Main Index |
Thread Index |
Old Index