Subject: kern/25393: autocompletion causes panic with portal fs
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <lsartran@no-log.org>
List: netbsd-bugs
Date: 04/29/2004 18:39:51
>Number:         25393
>Category:       kern
>Synopsis:       autocompletion causes panic with portal fs
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 29 18:40:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Laurent Sartran
>Release:        NetBSD 2.0E
>Organization:
>Environment:
NetBSD wow 2.0E NetBSD 2.0E (GENERIC) #0: Sun Apr 25 20:50:21 CEST 2004  ls@wow: /usr/obj/sys/arch/i386/compile/GENERIC i386
>Description:
When I try to autocomplete a path in a portal partition, kernel panics, with "genfs: bad op". 

(This may be related with this PR: http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=4287 )

A "trace" at the debugger prompt revealed that this kernel panic was generated by something related to advlock.

Between the 1.18 and 1.19 revision of the file /usr/src/sys/miscfs/portal/portal_vnops.c, on the line  #defining portal_advlock, portal_enotsupp which returned an error, was replaced with genfs_badop, which calls panic().

>How-To-Repeat:
I have a /pcvs directory and this line in my /etc/fstab:
/usr/share/examples/mount_portal/cvs.conf /pcvs portal rw 0 0

In a console (this didn't happen when I "systraced" bash in an xterm), type "cd /pcvs/ne" and press Tab. Kernel panics.
>Fix:
$ diff -u portal_vnops.c.~1.53.~ portal_vnops.c
--- portal_vnops.c.~1.53.~      2004-04-21 03:05:41.000000000 +0200
+++ portal_vnops.c      2004-04-29 19:25:51.000000000 +0200
@@ -105,7 +105,7 @@
 int    portal_print    __P((void *));
 #define        portal_islocked genfs_islocked
 int    portal_pathconf __P((void *));
-#define        portal_advlock  genfs_badop
+#define        portal_advlock  genfs_einval
 #define        portal_blkatoff genfs_badop
 #define        portal_valloc   genfs_eopnotsupp
 #define        portal_vfree    genfs_nullop

And the kernel doesn't panic anymore :)
>Release-Note:
>Audit-Trail:
>Unformatted: