Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Apr 1995 07:10:03 -0700
From:      pritc003@maroon.tc.umn.edu
To:        freebsd-bugs
Subject:   kern/303: msdosfs: moving a file into another directory causes panic
Message-ID:  <199504071410.HAA07924@freefall.cdrom.com>
In-Reply-To: Your message of Fri, 7 Apr 1995 09:08:44 -0500 <199504071408.JAA00346@mpp.com>

next in thread | previous in thread | raw e-mail | index | archive | help

>Number:         303
>Category:       kern
>Synopsis:       msdosfs: moving a file into another directory causes panic
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr  7 07:10:02 1995
>Originator:     Mike Pritchard
>Organization:
Mike Pritchard
>Release:        FreeBSD 2.1.0-Development i386
>Environment:


>Description:

When using an MS-DOS file system, attempting to move a file into a
subdirectory will result in the following panic:

panic: msdosfs_hashins: already locked

This is because 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.

>How-To-Repeat:

Mount a MS-DOS file system, cd to the mount point and do the following:

# touch zzz
# mkdir xxx
# mv zzz xxx
Boom!

>Fix:
	
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.


*** /usr/src/sys/msdosfs/msdosfs_denode.c	Sun Mar 19 09:19:07 1995
--- msdosfs/msdosfs_denode.c	Fri Apr  7 08:49:57 1995
***************
*** 119,131 ****
  	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
--- 119,124 ----
***************
*** 235,240 ****
--- 228,234 ----
  	 * can't be accessed until we've read it in and have done what we
  	 * need to it.
  	 */
+ 	VOP_LOCK(nvp);
  	msdosfs_hashins(ldep);
  
  	/*
>Audit-Trail:
>Unformatted:





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504071410.HAA07924>