On Fri, Nov 16, 2012 at 12:02:11PM -0300, Marcos Laufer wrote: > > Kenneth R Westerback wrote: > >On Thu, Nov 15, 2012 at 12:48:03PM -0300, Marcos Laufer wrote: > >>Kenneth R Westerback wrote: > >>>On Wed, Nov 14, 2012 at 04:22:20PM -0300, Marcos Laufer wrote: > >>>>Hello, i'd like to inform a problem when dettaching an external 1TB > >>>>USB disk drive , the system just freezes, i can't type anything. > >>>>Also It stops responding to ping. > >>>>If i don't unplug it then i can use the disk normally, i can copy > >>>>and delete files with no problem. But as soon as i unplug the USB > >>>>cord, the machine freezes. > >>>>I've tested it on several machines, different OpenBSD versions > >>>>starting from 4.3, i'm not asking for support, i know old OpenBSD > >>>>versions are no longer supported, but this seemed pretty odd, i > >>>>suppose that plugging and unplugging a USB disk should not cause any > >>>>problems on any OS version. > >>>> > >>>>These are the lines on dmesg about this disk: > >>>> > >>>> > >>>>Nov 14 16:00:31 hq /bsd: umass0 at uhub0 > >>>>Nov 14 16:00:31 hq /bsd: port 5 configuration 1 interface 0 > >>>>"Western Digital My Passport 0748" rev 2.10/10.15 addr 2 > >>>>Nov 14 16:00:31 hq /bsd: umass0: using SCSI over Bulk-Only > >>>>Nov 14 16:00:31 hq /bsd: scsibus0 at umass0: 2 targets, initiator 0 > >>>>Nov 14 16:00:31 hq /bsd: sd0 at scsibus0 targ 1 lun 0: <WD, My > >>>>Passport 0748, 1015> SCSI4 0/direct fixed > >>>>Nov 14 16:00:38 hq /bsd: sd0: 953837MB, 512 bytes/sec, 1953458176 sec > >>>>total > >>>>Nov 14 16:00:38 hq /bsd: ses0 at scsibus0 targ 1 lun 1: <WD, SES > >>>>Device, 1015> SCSI4 13/enclosure services fixed > >>>>Nov 14 16:00:38 hq /bsd: ses0: unable to read enclosure configuration > >>>> > >>>>Best regards, > >>>>Marcos > >>>> > >>>As an experiment, try going into boot's config (-c at the boot>) and > >>>"disable ses". Then see if a) the ses device is still present, and b) > >>>if the absence of the ses device(s) alleviate the symptoms. > >>> > >>>.... Ken > >>> > >>> > >>Hello, i've just tried this. The ses device is not present when i > >>disable it at boot time, but the problem persists, if i unplug the > >>USB cord (no matter if the partition is mounted or not) the OS just > >>freezes. So i guess it is not related to the ses driver. > >> > >>This are the dmesg lines of this experiment: > >> > >>Nov 15 12:32:52 hq /bsd: umass0 at uhub0 > >>Nov 15 12:32:52 hq /bsd: port 5 configuration 1 interface 0 > >>"Western Digital My Passport 0748" rev 2.10/10.15 addr 2 > >>Nov 15 12:32:52 hq /bsd: umass0: using SCSI over Bulk-Only > >>Nov 15 12:32:52 hq /bsd: scsibus0 at umass0: 2 targets, initiator 0 > >>Nov 15 12:32:52 hq /bsd: sd0 at scsibus0 targ 1 lun 0: <WD, My > >>Passport 0748, 1015> SCSI4 0/direct fixed > >>Nov 15 12:32:59 hq /bsd: sd0: 953837MB, 512 bytes/sec, 1953458176 sec total > >>Nov 15 12:32:59 hq /bsd: uk0 at scsibus0 targ 1 lun 1: <WD, SES > >>Device, 1015> SCSI4 13/enclosure services fixed > >> > > > >Arrg. Need to kill all reference to that second device. Try a kernel with > >this diff. It should prevent probing anything but lun 0. > > > >.... Ken > > > >Index: umass_scsi.c > >=================================================================== > >RCS file: /cvs/src/sys/dev/usb/umass_scsi.c,v > >retrieving revision 1.38 > >diff -u -p -r1.38 umass_scsi.c > >--- umass_scsi.c 17 Jul 2011 22:46:48 -0000 1.38 > >+++ umass_scsi.c 15 Nov 2012 17:17:06 -0000 > >@@ -92,7 +92,7 @@ umass_scsi_attach(struct umass_softc *sc > > scbus = umass_scsi_setup(sc); > > scbus->sc_link.adapter_target = UMASS_SCSIID_HOST; > >- scbus->sc_link.luns = sc->maxlun + 1; > >+ scbus->sc_link.luns = 1; > > scbus->sc_link.flags &= ~SDEV_ATAPI; > > scbus->sc_link.flags |= SDEV_UMASS; > > > > > Ken, i've applied your patch on an old OpenBSD 4.5 i use for testing > purposes and the problem got solved. Now i can unplug the USB disk > and no freeze at all. Is it safe to apply it on older and newer > OpenBSD versions as well? > > These are the new dmesg lines: > > umass0 at uhub0 port 5 configuration 1 interface 0 "Western Digital > My Passport 0748" rev 2.10/10.15 addr 2 > umass0: using SCSI over Bulk-Only > scsibus0 at umass0: 2 targets, initiator 0 > sd0 at scsibus0 targ 1 lun 0: <WD, My Passport 0748, 1015> SCSI4 > 0/direct fixed > sd0: 953837MB, 512 bytes/sec, 1953458176 sec total > > and after unpluggin the USB cord i get: > > sd0 detached > scsibus0 detached > umass0 detached > > And the OS does not freeze anymore. > > Thank you very much! >
I had deliberately NOT copied misc@ so random diagnostic patches are not floating around for the more excitable of our community to apply and forget about. :-) The diff is not the solution. It merely confirms that it is the ses* devices that are the problem. http://wdc.custhelp.com/app/answers/detail/a_id/3739/~/what-is-the-ses-driver,-why-is-it-needed,-and-how-to-get-the-driver-popup-to is a fascinating page that google found for me. If you have windows or os x available you might be able to disable the ses functionality, which would be a better solution. The proper OpenBSD solution is likely to involve upgrading the ses driver to properly get disconnected. .... Ken