From 2360b9bfc7554c6b6aa937b65eb0815ac5cf394d Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Tue, 11 Apr 1995 17:13:17 +0000 Subject: [PATCH] Submitted by: Mike Pritchard Fix PR 303: msdosfs: moving a file into another directory causes panic. " ... the code that does the rename already has the denode locked when msdosfs_hashins() gets called, resulting in the panic when the routine attempts to lock the denode again. ... The attached patch changes the msdosfs_hashins() routine to not lock the denode. The caller is now resposible for obtaining the lock instead of having msdosfs_hashins() do it for them." --- sys/fs/msdosfs/msdosfs_denode.c | 10 ++-------- sys/msdosfs/msdosfs_denode.c | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 17d163c0ada..c0e88239453 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_denode.c,v 1.9 1995/03/16 18:14:18 bde Exp $ */ +/* $Id: msdosfs_denode.c,v 1.10 1995/03/19 12:11:13 davidg Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.9 1994/08/21 18:44:00 ws Exp $ */ /*- @@ -119,13 +119,6 @@ msdosfs_hashins(dep) dep->de_next = deq; dep->de_prev = depp; *depp = dep; - if (dep->de_flag & DE_LOCKED) - panic("msdosfs_hashins: already locked"); - if (curproc) - dep->de_lockholder = curproc->p_pid; - else - dep->de_lockholder = -1; - dep->de_flag |= DE_LOCKED; } static void @@ -235,6 +228,7 @@ deget(pmp, dirclust, diroffset, direntptr, depp) * can't be accessed until we've read it in and have done what we * need to it. */ + VOP_LOCK(nvp); msdosfs_hashins(ldep); /* diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c index 17d163c0ada..c0e88239453 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_denode.c,v 1.9 1995/03/16 18:14:18 bde Exp $ */ +/* $Id: msdosfs_denode.c,v 1.10 1995/03/19 12:11:13 davidg Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.9 1994/08/21 18:44:00 ws Exp $ */ /*- @@ -119,13 +119,6 @@ msdosfs_hashins(dep) dep->de_next = deq; dep->de_prev = depp; *depp = dep; - if (dep->de_flag & DE_LOCKED) - panic("msdosfs_hashins: already locked"); - if (curproc) - dep->de_lockholder = curproc->p_pid; - else - dep->de_lockholder = -1; - dep->de_flag |= DE_LOCKED; } static void @@ -235,6 +228,7 @@ deget(pmp, dirclust, diroffset, direntptr, depp) * can't be accessed until we've read it in and have done what we * need to it. */ + VOP_LOCK(nvp); msdosfs_hashins(ldep); /*