Date: Thu, 14 Mar 96 21:33:15 +0900 From: Mihoko Tanaka <m_tanaka@pa.yokogawa.co.jp> To: freebsd-hackers@freebsd.org Subject: PANIC ( remove a file on the read-only FS) Message-ID: <9603141233.AA20013@cabbage.pa.yokogawa.co.jp>
next in thread | raw e-mail | index | archive | help
Hello all, I'm using FreeBSD-2.1.0R on my PC. When I removed a file which is on a read-only NFS by accident, panic occured ! In kern/vfs_lookup.c:lookup() ---------<extracts of kern/vfs_lookup.c:lookup()>--------------------- /* * We now have a segment name to search for, and a directory to search. */ unionlookup: ndp->ni_dvp = dp; error = VOP_LOOKUP(dp, &ndp->ni_vp, cnp); if (error) { #ifdef DIAGNOSTIC if (ndp->ni_vp != NULL) panic("leaf should be empty"); #endif ---------<extracs of kern/vfs_lookup.c:lookup() :END>--------------------- The function 'VOP_LOOKUP()' calls xxx_lookup() (xxx : file system name). When I remove a file which is on a read-only file system, VOP_LOOKUP() returns a error(EROFS) and ndp->ni_vp isn't NULL because it exist. So if I compile my kernel with 'DIAGNOSTIC', panic occurs . If without 'DIAGNOSTIC', the system conflicts somewhere and gets into panic. I made some patch for this trouble. Is it correct? Does anyone have another good idea? -----------------(cut here)------------------------------------------ --- vfs_lookup.c Wed Oct 25 18:17:15 1995 +++ vfs_lookup.c.new Thu Mar 14 20:23:05 1996 @@ -399,6 +399,9 @@ error = VOP_LOOKUP(dp, &ndp->ni_vp, cnp); if (error) { #ifdef DIAGNOSTIC + if (error == EROFS) + goto bad; + if (ndp->ni_vp != NULL) panic("leaf should be empty"); #endif @@ -422,7 +425,7 @@ * If creating and at end of pathname, then can consider * allowing file to be created. */ - if (rdonly) { + if (rdonly || (dp->v_mount->mnt_flag & MNT_RDONLY)) { error = EROFS; goto bad; } -----------------(cut here)------------------------------------------ -- Mihoko Tanaka <m_tanaka@pa.yokogawa.co.jp>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9603141233.AA20013>