Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ata Take channel lock for calling reset_drive.



details:   https://anonhg.NetBSD.org/src/rev/a03c31af0a4e
branches:  trunk
changeset: 451824:a03c31af0a4e
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Thu Jun 06 20:55:43 2019 +0000

description:
Take channel lock for calling reset_drive.
Should fix PR 54217.

diffstat:

 sys/dev/ata/wd.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 0abfe494e08e -r a03c31af0a4e sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Thu Jun 06 20:50:46 2019 +0000
+++ b/sys/dev/ata/wd.c  Thu Jun 06 20:55:43 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.451 2019/06/06 20:41:04 mlelstv Exp $ */
+/*     $NetBSD: wd.c,v 1.452 2019/06/06 20:55:43 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.451 2019/06/06 20:41:04 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.452 2019/06/06 20:55:43 mlelstv Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -1663,6 +1663,7 @@
 wd_get_params(struct wd_softc *wd, uint8_t flags, struct ataparams *params)
 {
        int retry = 0;
+       struct ata_channel *chp = wd->drvp->chnl_softc;
 
 again:
        switch (wd->atabus->ata_get_params(wd->drvp, flags, params)) {
@@ -1671,7 +1672,9 @@
        case CMD_ERR:
                if (retry == 0) {
                        retry++;
+                       ata_channel_lock(chp);
                        (*wd->atabus->ata_reset_drive)(wd->drvp, flags, NULL);
+                       ata_channel_unlock(chp);
                        goto again;
                }
 



Home | Main Index | Thread Index | Old Index