"s/stable/broken/g"
Kostik Belousov
kostikbel at gmail.com
Thu Mar 27 02:56:36 PDT 2008
On Thu, Mar 27, 2008 at 12:45:13AM +0100, Peter Much wrote:
> On Wed, Mar 26, 2008 at 05:00:12PM -0400, John Baldwin wrote:
>
> ! Try this patch for de(4).
>
> Thanks fpr the reply. I'll try this patch at next reboot.
>
> ! You need to supply the panic details for the devfs
> ! one (I've used devfs rules w/o issue on lots of machines
> ! via /etc/devfs.conf).
>
> I have found, eh, not the solution but the problem. ;)
> This one: kern/89784 describes the same symptom and nearly
> the same backtrace. And it is still open, so this, well, just
> seems to exist. And, things being this way, I don't think
> there is need for me to do any more about it for now, as
> this does not really hurt and workaround is easy.
Try the rev. 1.24 of the devfs_rule.c. In fact, it is fixed by somewhat
bigger patch that I inlined below. It is already in CURRENT and RELENG_7.
Index: fs/devfs/devfs_rule.c
===================================================================
RCS file: /usr/local/arch/ncvs/src/sys/fs/devfs/devfs_rule.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- fs/devfs/devfs_rule.c 6 Nov 2006 13:41:56 -0000 1.23
+++ fs/devfs/devfs_rule.c 20 Mar 2008 16:08:42 -0000 1.24
@@ -527,6 +527,7 @@
{
struct devfs_rule *dr = &dk->dk_rule;
struct cdev *dev;
+ struct cdevsw *dsw;
dev = devfs_rule_getdev(de);
/*
@@ -540,13 +541,19 @@
* They're actually testing to see whether the condition does
* *not* match, since the default is to assume the rule should
* be run (such as if there are no conditions).
- *
- * XXX: lacks threadref on dev
*/
- if (dr->dr_icond & DRC_DSWFLAGS)
- if (dev == NULL ||
- (dev->si_devsw->d_flags & dr->dr_dswflags) == 0)
+ if (dr->dr_icond & DRC_DSWFLAGS) {
+ if (dev == NULL)
+ return (0);
+ dsw = dev_refthread(dev);
+ if (dsw == NULL)
+ return (0);
+ if ((dsw->d_flags & dr->dr_dswflags) == 0) {
+ dev_relthread(dev);
return (0);
+ }
+ dev_relthread(dev);
+ }
if (dr->dr_icond & DRC_PATHPTRN)
if (!devfs_rule_matchpath(dk, de))
return (0);
Index: vm/vm_mmap.c
===================================================================
RCS file: /usr/local/arch/ncvs/src/sys/vm/vm_mmap.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -r1.217 -r1.218
--- vm/vm_mmap.c 16 Mar 2008 10:58:09 -0000 1.217
+++ vm/vm_mmap.c 20 Mar 2008 16:08:42 -0000 1.218
@@ -1160,6 +1160,7 @@
void *handle;
vm_object_t obj;
struct mount *mp;
+ struct cdevsw *dsw;
int error, flags, type;
int vfslocked;
@@ -1190,13 +1191,19 @@
type = OBJT_DEVICE;
handle = vp->v_rdev;
- /* XXX: lack thredref on device */
- if(vp->v_rdev->si_devsw->d_flags & D_MMAP_ANON) {
+ dsw = dev_refthread(handle);
+ if (dsw == NULL) {
+ error = ENXIO;
+ goto done;
+ }
+ if (dsw->d_flags & D_MMAP_ANON) {
+ dev_relthread(handle);
*maxprotp = VM_PROT_ALL;
*flagsp |= MAP_ANON;
error = 0;
goto done;
}
+ dev_relthread(handle);
/*
* cdevs does not provide private mappings of any kind.
*/
@@ -1273,16 +1280,21 @@
struct cdev *cdev, vm_ooffset_t foff, vm_object_t *objp)
{
vm_object_t obj;
+ struct cdevsw *dsw;
int flags;
flags = *flagsp;
- /* XXX: lack thredref on device */
- if (cdev->si_devsw->d_flags & D_MMAP_ANON) {
+ dsw = dev_refthread(cdev);
+ if (dsw == NULL)
+ return (ENXIO);
+ if (dsw->d_flags & D_MMAP_ANON) {
+ dev_relthread(cdev);
*maxprotp = VM_PROT_ALL;
*flagsp |= MAP_ANON;
return (0);
}
+ dev_relthread(cdev);
/*
* cdevs does not provide private mappings of any kind.
*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20080327/bb38d886/attachment.pgp
More information about the freebsd-stable
mailing list