Date: Tue, 6 Aug 2013 18:41:29 +0800 From: Jia-Shiun Li <jiashiun@gmail.com> To: Alexander Motin <mav@freebsd.org> Cc: Hans Petter Selasky <hps@bitfrost.no>, freebsd-current@freebsd.org Subject: Re: Panic at USB drive plugging in Message-ID: <CAHNYxxPp=P_LWAX9hJ3Q0kuiMp-wCeDT7iqWYRhRKzs4W6SY=w@mail.gmail.com> In-Reply-To: <CAHNYxxMUYOqv%2BR4Ggppaox0DAbq8KGhp0dQnCy9owz7EG0t-Hw@mail.gmail.com> References: <CAHNYxxNwhAJChd0=DErbBguqjoPFgfYDFjv-CRzi1WNDdUvExw@mail.gmail.com> <51EEAA36.6030206@bitfrost.no> <51EEABA3.7060909@FreeBSD.org> <CAHNYxxNuhh3waaYWvX3iCo7zFQWWHpW3sh2rKMO%2BKppTgLzxjQ@mail.gmail.com> <51EEE15C.6020900@FreeBSD.org> <CAHNYxxMUYOqv%2BR4Ggppaox0DAbq8KGhp0dQnCy9owz7EG0t-Hw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
2013/7/24 =E4=B8=8B=E5=8D=8810:26 =E6=96=BC "Jia-Shiun Li" <jiashiun@gmail.= com> =E5=AF=AB=E9=81=93=EF=BC=9A > On Wed, Jul 24, 2013 at 4:02 AM, Alexander Motin <mav@freebsd.org> wrote: > > cam.k kernel module includes all existing periph drivers in one bundle. > > Loading cam.ko you are probably getting sg driver also, that triggers > > reported issue. You may try to rip out sg with single line hack to > module's > > Makefile. The real fix require looking closer on sg, which I never used= . > > > > Indeed. Test result did confirm that if sg is not included in cam.ko > USB drives will not cause kernel to panic. > > Hi all, turns out, it may be conflicts between assumed and actual sg usage. The sg driver specifically assumes a write-read sequence. If a read comes first it will cause sg to panic at msleep() in sgread. In my case the process is hald-probe-storage tasting new devices. But it can be as simple as "dd if=3D/dev/sgX". I am wondering that, is sg necessary on FreeBSD? Since most applications seem to live happily without it in GENERIC kernel. Maybe we can isolate it from cam.ko to make cam usable as module, and make the standalone sg module depending on cam module before sg got more resistant to misuse? Regards, Jia-Shiun.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHNYxxPp=P_LWAX9hJ3Q0kuiMp-wCeDT7iqWYRhRKzs4W6SY=w>