[PATCH] SCSI deadlock+Oops for unsupp. sector size

Kurt Garloff (garloff@suse.de)
Sat, 28 Aug 1999 18:02:11 +0200


--p4qYPpj5QlsIQJ0K
Content-Type: multipart/mixed; boundary=zYM0uCDKw75PZbzx

--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Linus, Alan,

appended a patch to prevent the deadlock on io_request_lock.

If the sd code detected an invalid sector size, it didn't release the
io_request_lock acquired a few instructions above. Also the code to free the
unuseable disk was wrong: It left the attach counter with 1.
The code in revalidate_scsidisk stumbled across the removed disk with oopse=
s.

The attached patch (against 2.2.12) fixes these problems.

--=20
Kurt Garloff <garloff@suse.de> Wuppertal, FRG
PGP2 key: See mail header, key servers Linux kernel development
SuSE GmbH, N=FCrnberg, FRG SCSI drivers: tmscsim(DC390), DC395

--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Description: 22x-sd-unsupp-sector.diff
Content-Disposition: attachment; filename="22x-sd-unsupp-sector-spinlock.diff"
Content-Transfer-Encoding: quoted-printable

--- linux/drivers/scsi/sd.c.orig Fri Aug 27 13:39:10 1999
+++ linux/drivers/scsi/sd.c Sat Aug 28 17:02:07 1999
@@ -1358,15 +1358,19 @@
rscsi_disks[i].capacity =3D 0;
} else {
printk ("scsi : deleting disk entry.\n");
+ sd_detach(rscsi_disks[i].device);
rscsi_disks[i].device =3D NULL;
+ /*
sd_template.nr_dev--;
SD_GENDISK(i).nr_real--;
-
+ */
/* Wake up a process waiting for device */
wake_up(&SCpnt->device->device_wait);
scsi_release_command(SCpnt);
SCpnt =3D NULL;
=20
+ scsi_free(buffer, 512);
+ spin_unlock_irq(&io_request_lock);
return i;
}
}
@@ -1720,6 +1724,7 @@
#endif
=20
sd_gendisks->part[start].nr_sects =3D CAPACITY;
+ if (!rscsi_disks[target].device) return -EBUSY;
resetup_one_dev(&SD_GENDISK(target),
target % SCSI_DISKS_PER_MAJOR);
=20

--zYM0uCDKw75PZbzx--

--p4qYPpj5QlsIQJ0K
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i

iQCVAwUBN8gIAxaQN/7O/JIVAQEN6gP/cfpi2tmw/46LTqEUM2CEch6k02f/Ayta
jGC/4v62Py5eNbmEwUD3ZyB+qfR0+XnCacsynFKhHlOhqmWz2HxZjfW8KBH/IAvM
AmojHCs9PW1lV8aVixZNrhMFILC9rkjX5xIvpY1aTg8UPj+6EL44j5+uXKkwGiyS
EnFsDiG3DqY=
=d/Xr
-----END PGP SIGNATURE-----

--p4qYPpj5QlsIQJ0K--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/