Module Name:    src
Committed By:   mlelstv
Date:           Thu Jun  6 20:55:43 UTC 2019

Modified Files:
        src/sys/dev/ata: wd.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.451 -r1.452 src/sys/dev/ata/wd.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/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.451 src/sys/dev/ata/wd.c:1.452
--- src/sys/dev/ata/wd.c:1.451	Thu Jun  6 20:41:04 2019
+++ src/sys/dev/ata/wd.c	Thu Jun  6 20:55:43 2019
@@ -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 @@ int
 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 @@ again:
 	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;
 		}
 

Reply via email to