Date: Sat, 5 Aug 2006 17:17:51 +0200 From: "Michiel Pelt" <pelt22@gmail.com> To: freebsd-fs@freebsd.org Subject: VOP_LOOKUP of .. in msdosfs Message-ID: <cee5e2ee0608050817u67f0c08cw73ec68f54400375b@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi, I am developing a filesystem which doesn't have a . and .. in the root. So I emulate them, just like msdosfs does. I looked at the msdosfs code. Correct me if I am wrong, but I think there is something wrong with it. The msdosfs_lookup function in msdosfs_lookup.c has code dealing with the rootdirectory at the label foundroot:. At line 523 (release 6.1 code) of the release code is this piece of code: pdp = vdp; if (flags & ISDOTDOT) { VOP_UNLOCK(pdp, 0, td); error = deget(pmp, cluster, blkoff, &tdp); vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td); if (error) return (error); *vpp = DETOV(tdp); } This code has been copied from ffs code, but fails for msdosfs. For starters the introduction of the 'pdp' pointer has no function whatsoever. Consider a lookup for .. in the root. In msdosfs the /. and /.. directories are represented by one and the same vnode (see deget() in msdosfs_denode.c). The deget gets and locks the vnode that was unlocked by VOP_UNLOCK. The vn_lock that follows fails with a panic because the vnode is already locked. So why does this not happen in practice? Because the ISDOTDOT case is handled by vfs_lookup and never reaches VOP_LOOKUP. I did get the error because I forgot to set the VV_ROOT flag in the vnode returned by VFS_ROOT ;-(. Best Regards Michiel
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cee5e2ee0608050817u67f0c08cw73ec68f54400375b>