Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Feb 2003 12:15:15 +0900
From:      Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
To:        "Daniel O'Connor" <doconnor@gsoft.com.au>
Cc:        FreeBSD Stable List <freebsd-stable@freebsd.org>, Hidetoshi Shimokawa <simokawa@freebsd.org>
Subject:   Re: sbp + drive enclosures
Message-ID:  <ybs3cmsswfw.wl@ett.sat.t.u-tokyo.ac.jp>
In-Reply-To: <ybs8ywlrm6e.wl@ett.sat.t.u-tokyo.ac.jp>
References:  <1045096485.398.14.camel@chowder.gsoft.com.au> <ybsadh1rnsz.wl@ett.sat.t.u-tokyo.ac.jp> <1045099783.398.20.camel@chowder.gsoft.com.au> <ybs8ywlrm6e.wl@ett.sat.t.u-tokyo.ac.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
At Thu, 13 Feb 2003 10:42:17 +0900,
Hidetoshi Shimokawa wrote:
> > > This behavier enables us active filesystem detaching and reattaching.
> > > Even while the some process is writing/reading activily on the
> > > filesystem it sould be safely detached and then reattached safely.
> > 
> > OK, I wasn't sure given my other problem ;)
> 
> It seems that I should put back some M_NOWAIT flags to malloc.
> I'll send you patch later.

Here is a patch expected to fix the panic.

/\ Hidetoshi Shimokawa
\/  simokawa@sat.t.u-tokyo.ac.jp
PGP public key: http://www.sat.t.u-tokyo.ac.jp/~simokawa/pgp.html

Index: sbp.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/firewire/sbp.c,v
retrieving revision 1.29
diff -u -r1.29 sbp.c
--- sbp.c	9 Feb 2003 07:40:27 -0000	1.29
+++ sbp.c	13 Feb 2003 03:11:39 -0000
@@ -521,13 +521,13 @@
 	chdr = (struct csrhdr *)&fwdev->csrrom[0];
 	creg = (struct csrreg *)chdr;
 	creg += chdr->info_len;
-	for( i = chdr->info_len + 4; i <= fwdev->rommax; i+=4){
+	for( i = chdr->info_len + 4; i <= fwdev->rommax - 4; i+=4){
 		if((creg++)->key == key){
 			found = 1;
 			break;
 		}
 	}
-	if (!found) {
+	if (!found || creg->key != CROM_TEXTLEAF) {
 		strncpy(buf, nullstr, len);
 		return;
 	}
@@ -780,7 +780,13 @@
 static void
 sbp_cam_scan_lun(struct sbp_dev *sdev)
 {
-	union ccb *ccb = malloc(sizeof(union ccb), M_SBP, M_ZERO);
+	union ccb *ccb;
+
+	ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO);
+	if (ccb == NULL) {
+		printf("sbp_cam_scan_lun: malloc failed\n");
+		return;
+	}
 
 SBP_DEBUG(0)
 	sbp_show_sdev_info(sdev, 2);
@@ -840,9 +846,20 @@
 	union ccb *ccb;
 	struct scsi_inquiry_data *inq_buf;
 
-	ccb = malloc(sizeof(union ccb), M_SBP, M_ZERO);
+
+	ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO);
+	if (ccb == NULL) {
+		printf("sbp_ping_unit: malloc failed\n");
+		return;
+	}
+
 	inq_buf = (struct scsi_inquiry_data *)
-			malloc(sizeof(*inq_buf), M_SBP, 0);
+			malloc(sizeof(*inq_buf), M_SBP, M_NOWAIT);
+	if (inq_buf == NULL) {
+		free(ccb, M_SBP);
+		printf("sbp_ping_unit: malloc failed\n");
+		return;
+	}
 
 SBP_DEBUG(0)
 	sbp_show_sdev_info(sdev, 2);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ybs3cmsswfw.wl>