From owner-freebsd-current@FreeBSD.ORG Sat Nov 22 00:02:45 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E463C1065677 for ; Sat, 22 Nov 2008 00:02:44 +0000 (UTC) (envelope-from onemda@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.31]) by mx1.freebsd.org (Postfix) with ESMTP id 8DBD78FC16 for ; Sat, 22 Nov 2008 00:02:44 +0000 (UTC) (envelope-from onemda@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so524464ywe.13 for ; Fri, 21 Nov 2008 16:02:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=kk4+aQnlFLuj1oX3Vjim1LrDLCu6Tb2FBv7Bkb2PPbQ=; b=MgFyy/jQjYjakqJc+X4YV2SwOPFaC4KQ/VIma3e1VpeZJoahHc5U1GDjheLKAfja1P l33Xw88iHdQgpke2QCGXUd2x0bUuDhaVoB5z+KneF7NFCXcdm1+/8pW8Aexu8PCelrul 2wonSS8MKHrZKGzjtXX1TM4pC6WA8EZZzk3Ck= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=xsx6VF5XLfvUWd7lmC5/d+cc3LDxrta0Nt4BiBT0kJ4ql0gDhPVU0UuNCVZVJ2Dazk DvFC4El0Gl7raN7vozo/e9dMPItDfjpfe9oGZfBsEyIF3QVAcX3g4FG4vYVMpR/LenZY nCwP0hBWI4Lz6D5Wp9KhbWvFP1k8ASZx8VU/Y= Received: by 10.231.20.5 with SMTP id d5mr27978ibb.14.1227312162913; Fri, 21 Nov 2008 16:02:42 -0800 (PST) Received: by 10.231.11.7 with HTTP; Fri, 21 Nov 2008 16:02:42 -0800 (PST) Message-ID: <3a142e750811211602h3855e912g573f53b00f6ce452@mail.gmail.com> Date: Sat, 22 Nov 2008 01:02:42 +0100 From: "Paul B. Mahol" To: "John Baldwin" In-Reply-To: <200811211452.02545.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811201627.58289.jhb@freebsd.org> <3a142e750811201532u6e697488w2747242e0a8614a9@mail.gmail.com> <200811211452.02545.jhb@freebsd.org> Cc: scottl@freebsd.org, current@freebsd.org Subject: Re: [PATCH] Make udf(4) MPSAFE and use shared lookups X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 00:02:45 -0000 On 11/21/08, John Baldwin wrote: > On Thursday 20 November 2008 06:32:25 pm Paul B. Mahol wrote: >> On 11/20/08, John Baldwin wrote: >> > So this patch is fairly minimal since udf(4) is currently read-only. >> > The >> > changes include: >> > >> > * Set VV_ROOT in udf_vget() if we ever return a vnode instead of doing >> > it >> > only >> > in udf_root(). This matches the behavior of other operating systems >> > and >> > correctly tags the root vnode with VV_ROOT in the unlikely case that >> > we >> > create the vnode during a call to ufs_vget() that does not come from >> > ufs_root(). >> > * If the hash lookup in ufs_vget() fails, ensure an exclusive vnode lock >> > > is >> > used while creating the new vnode (same as UFS). >> > * Allow lock recursion (XXX: not really sure this is needed actually). >> > * Allow shared vnode locks on non-fifos. >> > * Honor the requested locking flags (shared vs exclusive) instead of > always >> > using exclusive vnode locks during a lookup operation. >> > * Handle "." lookups the same way other filesystems do by just bumping >> > the >> > reference on 'dvp' rather than calling udf_vget(). >> > >> > http://www.FreeBSD.org/~jhb/patches/udf_mpsafe.patch >> > >> > I have only verified that this compiles and would appreciate it if some >> > folks >> > could test this, preferable with INVARIANTS and DEBUG_VFS_LOCKS enabled. >> >> I lightly tested it with md(4) on 47M size iso created with k3b >> (it contains two files) >> >> I only got this lor related to udf: >> >> lock order reversal: >> 1st 0xc4449270 udf (udf) @ /usr/src/sys/kern/vfs_lookup.c:442 >> 2nd 0xd7d10850 bufwait (bufwait) @ /usr/src/sys/kern/vfs_bio.c:2443 >> 3rd 0xc4399488 udf (udf) @ >> /usr/src/sys/modules/udf/../../fs/udf/udf_vfsops.c:625 > > I've updated the patch at the same URL above to fix this LOR. > > -- > John Baldwin > Some bad news, using new patch (did not tested agains old one) I was able to reliable panic system with 3.4GB iso, trying to play music files via cplay. here is backtrack, from textdump: db:1:lockinfo> show locks db:1:locks> show alllocks Process 977 (python) thread 0xc43b4d80 (100087) db:1:alllocks> show lockedvnods Locked vnodes db:0:kdb.enter.panic> show pcpu cpuid = 1 curthread = 0xc43b4d80: pid 977 "initial thread" curpcb = 0xc3b67d90 fpcurthread = none idlethread = 0xc3d2ad80: pid 10 "idle: cpu1" APIC ID = 1 currentldt = 0x50 spin locks held: db:0:kdb.enter.panic> bt Tracing pid 977 tid 100087 td 0xc43b4d80 kdb_enter(c069b0df,c069b0df,c06a5d32,c3b67968,1,...) at kdb_enter+0x3a panic(c06a5d32,10800,10000,c0686786,c3b679d0,...) at panic+0x131 getblk(c4e0e10c,424,0,10800,0,...) at getblk+0x2d breadn(c4e0e10c,424,0,10800,0,...) at breadn+0x44 bread(c4e0e10c,424,0,10800,0,...) at bread+0x4c udf_readatoffset(1a18,0,c50568d8,c50568dc,0,...) at udf_readatoffset+0xbb udf_getfid(c4694680,ffffffff,c3b67cf8,c06a8594,c3b67c24,...) at udf_getfid+0x1ca udf_readdir(c3b67c24,0,c4555648,0,c3b67c5c,...) at udf_readdir+0xdc VOP_READDIR_APV(c4faf280,c3b67c24,c06a8594,ff3,1a18,...) at VOP_READDIR_APV+0xa0 kern_getdirentries(c43b4d80,46,2844c000,1000,c3b67c78,...) at kern_getdirentries+0x1bd getdirentries(c43b4d80,c3b67cf8,10,c06a1b96,c06cfbe0,...) at getdirentries+0x31 syscall(c3b67d38) at syscall+0x261 Xint0x80_syscall() at Xint0x80_syscall+0x20 --- syscall (196, FreeBSD ELF32, getdirentries), eip = 0x28251e4b, esp = 0xbfbfe27c, ebp = 0xbfbfe2a8 --- and panic message: uiomove returned -1 panic: getblk: size(67584) > MAXBSIZE(65536) cpuid = 1 KDB: enter: panic exclusive lockmgr udf (udf) r = 0 (0xc45556a0) locked @ /usr/src/sys/kern/vfs_syscalls.c:4083 exclusive lockmgr udf (udf) r = 0 (0xc45556a0) locked @ /usr/src/sys/kern/vfs_syscalls.c:4083 0xc4555648: tag udf, type VDIR usecount 1, writecount 0, refcount 1 mountedhere 0 flags () v_object 0xc479ac98 ref 0 pages 0 lock type udf: EXCL by thread 0xc43b4d80 (pid 977) -- Paul