From nobody@FreeBSD.ORG  Wed Aug 23 09:32:13 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id F356837B422; Wed, 23 Aug 2000 09:32:12 -0700 (PDT)
Message-Id: <20000823163212.F356837B422@hub.freebsd.org>
Date: Wed, 23 Aug 2000 09:32:12 -0700 (PDT)
From: chrisx77@hotmail.com
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: deadlocking when using vnode disk file and quotas
X-Send-Pr-Version: www-1.0

>Number:         20804
>Category:       kern
>Synopsis:       deadlocking when using vnode disk file and quotas
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 23 09:40:01 PDT 2000
>Closed-Date:    Sat Mar 01 19:40:39 UTC 2008
>Last-Modified:  Sat Mar 01 19:40:39 UTC 2008
>Originator:     Chris Jones
>Release:        FreeBSD-STABLE
>Organization:
Deadprotocol Society
>Environment:
FreeBSD tetsuo.deadprotocol.org 4.0-STABLE FreeBSD 4.0-STABLE #17: Mon Aug 21 08:05:56 PDT 2000     root@tetsuo.deadprotocol.org:/usr/src/sys/compile/TETSUO  i386
>Description:
The problem is that I want the quotas 
to work inside of a jail which is running with the vnode disk as it's "root" 
directory.  The problem that I'm having is that after turning on the quotas 
(this must be done outside of the jail), if I try to access a file which 
already has a quota, or I try to modify the quota using edquota (from inside 
of the jail), the process locks.  Once the process is locked, there is no 
way to kill it, and any subsequent accesses to the vnode disk also locks. 
These processes will stop in 1 of 5 different tsleep statements (inode, 
chkdq1, chkdq2, chkiq1, or chkiq2).  I am assuming that the problems is that 
the main filesystem puts a lock on the vnode disk file, and subsequently 
tries to lock the indoe inside of the file and is unable b/c of the previous 
lock on the vnode disk file.  

This is being submitted at the request of Robert Watson.
>How-To-Repeat:
set up a jail whose root directory is a filesystem in a file (vnode disk), and then turn on quotas from outside of the jail.  After doing this, from inside the jail, use the edquota command
>Fix:
none as of yet.

>Release-Note:
>Audit-Trail:

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: rwatson@freebsd.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
Date: Thu, 24 Aug 2000 11:19:33 +0200

 On Wed, 23 Aug 2000 09:32:12 MST, chrisx77@hotmail.com wrote:
 
 > >Number:         20804
 > >Category:       kern
 > >Synopsis:       deadlocking when using vnode disk file and quotas
 [...]
 
 > This is being submitted at the request of Robert Watson.
 
 Robert, do you want this PR for yourself, or was it your intention to
 have it assigned to phk?
 
 Ciao,
 Sheldon.
 
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Thu Aug 24 06:18:28 PDT 2000 
State-Changed-Why:  
Duplicate of PR 20787. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20804 

From: Robert Watson <rwatson@freebsd.org>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
Date: Thu, 24 Aug 2000 09:37:05 -0400 (EDT)

 On Thu, 24 Aug 2000, Sheldon Hearn wrote:
 
 > On Wed, 23 Aug 2000 09:32:12 MST, chrisx77@hotmail.com wrote:
 > 
 > > >Number:         20804
 > > >Category:       kern
 > > >Synopsis:       deadlocking when using vnode disk file and quotas
 > [...]
 > 
 > > This is being submitted at the request of Robert Watson.
 > 
 > Robert, do you want this PR for yourself, or was it your intention to
 > have it assigned to phk?
 
 If phk will accept it, that's probably best, as I believe md is his baby,
 and it's a recursive locking issue relating to UFS and md.  If not, I'll
 take it but it may take me a bit to solve the problem as I'll be moving
 to Massachusetts next week, and will be dealing with packing, furniture,
 etc. :-)  I did request that a PR be filed as I think this is an important
 bug for us to work through.
 
 
   Robert N M Watson 
 
 robert@fledge.watson.org              http://www.watson.org/~robert/
 PGP key fingerprint: AF B5 5F FF A6 4A 79 37  ED 5F 55 E9 58 04 6A B1
 TIS Labs at Network Associates, Safeport Network Services
 
 
 

From: Robert Watson <rwatson@FreeBSD.org>
To: phk@FreeBSD.org
Cc: freebsd-gnats-submit@FreeBSD.org,
	Sheldon Hearn <sheldonh@uunet.co.za>
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
Date: Thu, 24 Aug 2000 09:39:17 -0400 (EDT)

 Poul-Henning,
 
 Do you have a chance to look at this bug, which was raised on -fs
 recently?  It has to do, I believe, with a recursive lock/deadlock issue
 relating to the md device and the UFS quota implementation, presumably a
 lock ordering issue relating to the md device vnode lock and the vnode
 lock for the quota data file on that file system.  I haven't had a chance
 to look much further, and apparently it mostly manifests in jail (I'm not
 sure I understand why that might be the case -- possibly having to do with
 the starting point (root) for recursive name lookups with lock requests).
 
 Thanks,
 
   Robert N M Watson 
 
 robert@fledge.watson.org              http://www.watson.org/~robert/
 PGP key fingerprint: AF B5 5F FF A6 4A 79 37  ED 5F 55 E9 58 04 6A B1
 TIS Labs at Network Associates, Safeport Network Services
 
 ---------- Forwarded message ----------
 Date: Thu, 24 Aug 2000 11:19:33 +0200
 From: Sheldon Hearn <sheldonh@uunet.co.za>
 To: rwatson@freebsd.org
 Cc: freebsd-gnats-submit@freebsd.org
 Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
 
 
 
 On Wed, 23 Aug 2000 09:32:12 MST, chrisx77@hotmail.com wrote:
 
 > >Number:         20804
 > >Category:       kern
 > >Synopsis:       deadlocking when using vnode disk file and quotas
 [...]
 
 > This is being submitted at the request of Robert Watson.
 
 Robert, do you want this PR for yourself, or was it your intention to
 have it assigned to phk?
 
 Ciao,
 Sheldon.
 
 
State-Changed-From-To: closed->open 
State-Changed-By: sheldonh 
State-Changed-When: Thu Aug 24 06:48:09 PDT 2000 
State-Changed-Why:  
PR grunt on drugs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20804 

From: Poul-Henning Kamp <phk@critter.freebsd.dk>
To: Robert Watson <rwatson@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org,
	Sheldon Hearn <sheldonh@uunet.co.za>
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
Date: Thu, 24 Aug 2000 15:43:02 +0200

 In message <Pine.NEB.3.96L.1000824093709.31571B-100000@fledge.watson.org>, Robe
 rt Watson writes:
 >
 >Poul-Henning,
 >
 >Do you have a chance to look at this bug, which was raised on -fs
 >recently?  It has to do, I believe, with a recursive lock/deadlock issue
 >relating to the md device and the UFS quota implementation, presumably a
 >lock ordering issue relating to the md device vnode lock and the vnode
 >lock for the quota data file on that file system.  I haven't had a chance
 >to look much further, and apparently it mostly manifests in jail (I'm not
 >sure I understand why that might be the case -- possibly having to do with
 >the starting point (root) for recursive name lookups with lock requests).
 >
 >Thanks,
 >
 >  Robert N M Watson 
 
 Robert,
 
 No I haven't even looked at it.  The jail stuff doesn't even know
 what a lock is, much less touch one, so the jail involvement was
 not enough to make me put it on my busy schedule...
 
 --
 Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
 phk@FreeBSD.ORG         | TCP/IP since RFC 956
 FreeBSD coreteam member | BSD since 4.3-tahoe    
 Never attribute to malice what can adequately be explained by incompetence.
 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc: Robert Watson <rwatson@freebsd.org>,
	freebsd-gnats-submit@freebsd.org
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
Date: Thu, 24 Aug 2000 15:50:31 +0200

 On Thu, 24 Aug 2000 15:43:02 +0200, Poul-Henning Kamp wrote:
 
 > No I haven't even looked at it.  The jail stuff doesn't even know
 > what a lock is, much less touch one, so the jail involvement was
 > not enough to make me put it on my busy schedule...
 
 From Robert's earlier comments, it sounds more like an MD thing than a
 jail thing?
 
 Ciao,
 Sheldon.
 

From: Poul-Henning Kamp <phk@critter.freebsd.dk>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: Robert Watson <rwatson@freebsd.org>,
	freebsd-gnats-submit@freebsd.org
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
Date: Thu, 24 Aug 2000 15:58:27 +0200

 In message <84319.967125031@axl.fw.uunet.co.za>, Sheldon Hearn writes:
 >
 >
 >On Thu, 24 Aug 2000 15:43:02 +0200, Poul-Henning Kamp wrote:
 >
 >> No I haven't even looked at it.  The jail stuff doesn't even know
 >> what a lock is, much less touch one, so the jail involvement was
 >> not enough to make me put it on my busy schedule...
 >
 >>From Robert's earlier comments, it sounds more like an MD thing than a
 >jail thing?
 
 The only thing magic about MD is it's access time...
 
 --
 Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
 phk@FreeBSD.ORG         | TCP/IP since RFC 956
 FreeBSD coreteam member | BSD since 4.3-tahoe    
 Never attribute to malice what can adequately be explained by incompetence.
 

From: Robert Watson <rwatson@FreeBSD.org>
To: Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc: freebsd-gnats-submit@FreeBSD.org,
	Sheldon Hearn <sheldonh@uunet.co.za>
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
Date: Thu, 24 Aug 2000 09:56:34 -0400 (EDT)

 On Thu, 24 Aug 2000, Poul-Henning Kamp wrote:
 
 > In message <Pine.NEB.3.96L.1000824093709.31571B-100000@fledge.watson.org>, Robe
 > rt Watson writes:
 > >
 > >Poul-Henning,
 > >
 > >Do you have a chance to look at this bug, which was raised on -fs
 > >recently?  It has to do, I believe, with a recursive lock/deadlock issue
 > >relating to the md device and the UFS quota implementation, presumably a
 > >lock ordering issue relating to the md device vnode lock and the vnode
 > >lock for the quota data file on that file system.  I haven't had a chance
 > >to look much further, and apparently it mostly manifests in jail (I'm not
 > >sure I understand why that might be the case -- possibly having to do with
 > >the starting point (root) for recursive name lookups with lock requests).
 > 
 > No I haven't even looked at it.  The jail stuff doesn't even know
 > what a lock is, much less touch one, so the jail involvement was
 > not enough to make me put it on my busy schedule...
 
 My impression was that the bug had more to do with "md" -- is md yours, or
 someone else's?  The reason I'm looking at the jail issue is that that's
 how the reporter of the bug described it.  The interaction with jail() has
 to do with chroot() and recursive name lookup and locking: when a process
 is jailed, the name lookup, and hence tree walking and lock handling,
 starts at a different point in the tree, probably with a root in the md
 file system, which could affect the locking issues.
 
 
   Robert N M Watson 
 
 robert@fledge.watson.org              http://www.watson.org/~robert/
 PGP key fingerprint: AF B5 5F FF A6 4A 79 37  ED 5F 55 E9 58 04 6A B1
 TIS Labs at Network Associates, Safeport Network Services
 
 
 

From: Robert Watson <rwatson@freebsd.org>
To: Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc: Sheldon Hearn <sheldonh@uunet.co.za>,
	freebsd-gnats-submit@freebsd.org
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
Date: Thu, 24 Aug 2000 10:01:33 -0400 (EDT)

 On Thu, 24 Aug 2000, Poul-Henning Kamp wrote:
 
 > In message <84319.967125031@axl.fw.uunet.co.za>, Sheldon Hearn writes:
 > >
 > >> No I haven't even looked at it.  The jail stuff doesn't even know
 > >> what a lock is, much less touch one, so the jail involvement was
 > >> not enough to make me put it on my busy schedule...
 > >
 > >>From Robert's earlier comments, it sounds more like an MD thing than a
 > >jail thing?
 > 
 > The only thing magic about MD is it's access time...
 
 I guess the magic question for the bug reporter would be, ``if you run
 edquota from within a jail on a non-md disk, does the same lock problem
 occur''.  He may have listed this in the original PR, but I don't recall.
 
 
   Robert N M Watson 
 
 robert@fledge.watson.org              http://www.watson.org/~robert/
 PGP key fingerprint: AF B5 5F FF A6 4A 79 37  ED 5F 55 E9 58 04 6A B1
 TIS Labs at Network Associates, Safeport Network Services
 
 
 

From: Poul-Henning Kamp <phk@critter.freebsd.dk>
To: Robert Watson <rwatson@freebsd.org>
Cc: Sheldon Hearn <sheldonh@uunet.co.za>,
	freebsd-gnats-submit@freebsd.org
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas 
Date: Thu, 24 Aug 2000 16:12:44 +0200

 In message <Pine.NEB.3.96L.1000824100047.31571D-100000@fledge.watson.org>, Robe
 rt Watson writes:
 >On Thu, 24 Aug 2000, Poul-Henning Kamp wrote:
 >
 >> In message <84319.967125031@axl.fw.uunet.co.za>, Sheldon Hearn writes:
 >> >
 >> >> No I haven't even looked at it.  The jail stuff doesn't even know
 >> >> what a lock is, much less touch one, so the jail involvement was
 >> >> not enough to make me put it on my busy schedule...
 >> >
 >> >>From Robert's earlier comments, it sounds more like an MD thing than a
 >> >jail thing?
 >> 
 >> The only thing magic about MD is it's access time...
 >
 >I guess the magic question for the bug reporter would be, ``if you run
 >edquota from within a jail on a non-md disk, does the same lock problem
 >occur''.  He may have listed this in the original PR, but I don't recall.
 
 It think this is a preexisting bug which jail/chroot + MD exposes.
 
 --
 Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
 phk@FreeBSD.ORG         | TCP/IP since RFC 956
 FreeBSD coreteam member | BSD since 4.3-tahoe    
 Never attribute to malice what can adequately be explained by incompetence.
 

From: Tony Arcieri <tarcieri@atmos.colostate.edu>
To: bascule@gmail.com, freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/20804: deadlocking when using vnode disk file and quotas
Date: Tue, 9 Nov 2004 13:11:22 -0700

 I've experienced this problem in FreeBSD 5.3-RELEASE as well, and I 
 believe it's tied to the quota.user file.  Placing the quota.user file 
 outside the md filesystem by mounting the md device using the 
 userquota=/anywhere/outside/the/loopback/filesystem does *not* result 
 in a deadlock and, in fact, seems to work perfectly.
 
 Tony Arcieri
 
State-Changed-From-To: open->feedback 
State-Changed-By: kmacy 
State-Changed-When: Fri Nov 16 03:54:17 UTC 2007 
State-Changed-Why:  

may be fixed  

http://www.freebsd.org/cgi/query-pr.cgi?pr=20804 
State-Changed-From-To: feedback->closed 
State-Changed-By: linimon 
State-Changed-When: Sat Mar 1 19:40:05 UTC 2008 
State-Changed-Why:  
Feedback timeout (> 3 months). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20804 
>Unformatted:
Is this still an issue in RELENG_6 post SMP VFS?
