From owner-freebsd-fs@FreeBSD.ORG Mon Apr 9 11:58:58 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 315241065676 for ; Mon, 9 Apr 2012 11:58:58 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id AB8C18FC15 for ; Mon, 9 Apr 2012 11:58:57 +0000 (UTC) Received: by lbok6 with SMTP id k6so2440271lbo.13 for ; Mon, 09 Apr 2012 04:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=33kiFSs2kEPf5Dk/4u3C7Pzil4vWYeZI8v4V7MDpRl4=; b=I3FUB3dc+vbbHWeuYz4c/Q/CdJXz2L3MtvNrj1u7w2dingQXjK9xM3udeRgi7OaTgG C2MRikDoXWEpkRK+szgIoMVMg+9zyElkvZ+imF0auxmEgf51l2xQseYbqnqgY0fGwlM/ AY6wbDuRkvQtBzVwLSPkMqQ5XUZGAMxRWzDZ5Np91OeJsahj3akcmQxWC0fP6/O9DhcP zNUmDI8ngHhWtOFLWAfeGWgn87AtMksJyuiEN81RtOXN5PHwi4PMu7xLNJ6P4U920b6Q 9eB3VEKtSn/oLprovoHOy6IL0QQhVE16jKdS/4jcutJ9erc0/FFr8tkslfnY22FVVx7Z XlTQ== MIME-Version: 1.0 Received: by 10.152.125.41 with SMTP id mn9mr11057672lab.30.1333972730598; Mon, 09 Apr 2012 04:58:50 -0700 (PDT) Received: by 10.152.25.69 with HTTP; Mon, 9 Apr 2012 04:58:50 -0700 (PDT) Date: Mon, 9 Apr 2012 15:58:50 +0400 Message-ID: From: Sergey Kandaurov To: freebsd-fs@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: [patch] ufs extattr panic w/ quota under DIAGNOSTIC X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2012 11:58:58 -0000 Hi. This is a patch to fix ufs extattr panic seen when trying to set extended attributes on a file system with quotas enabled and options DIAGNOSTIC. # setextattr system md5 `md5 -q /boot/kernel/kernel` /boot/kernel/kernel The problem is that when getting at chkdquot() from UFS_BALLOC() it is expected that the vnode to operate extattr on was "prepared" with getinoquota(). This assertion is explicitly turned off for snapshots and quota files by setting VV_SYSTEM vnode flag. This is probably should be also done for extended attributes. Index: sys/ufs/ffs/ffs_vnops.c =================================================================== --- sys/ufs/ffs/ffs_vnops.c (revision 233936) +++ sys/ufs/ffs/ffs_vnops.c (working copy) @@ -1681,6 +1681,8 @@ vop_setextattr { return (error); } + ap->a_vp->v_vflag |= VV_SYSTEM; + error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td); if (error) return (error); chkdquot: missing dquot 0xfffffe00483744e0: tag ufs, type VREG usecount 1, writecount 0, refcount 567 mountedhere 0 flags () v_object 0xfffffe004839bbc8 ref 0 pages 2260 lock type ufs: EXCL by thread 0xfffffe004844a000 (pid 11419, setextattr, tid 100136) #9 0xffffffff804380f7 in panic (fmt=Variable "fmt" is not available. ) at /usr/src/sys/kern/kern_shutdown.c:633 #10 0xffffffff80666f94 in chkdquot (ip=0xfffffe00669749d8) at /usr/src/sys/ufs/ufs/ufs_quota.c:479 #11 0xffffffff8066765c in chkdq (ip=0xfffffe00669749d8, change=4, cred=0xfffffe0071d0a800, flags=0) at /usr/src/sys/ufs/ufs/ufs_quota.c:174 #12 0xffffffff80632879 in ffs_alloc (ip=0xfffffe00669749d8, lbn=Variable "lbn" is not available. ) at /usr/src/sys/ufs/ffs/ffs_alloc.c:184 #13 0xffffffff80635b49 in ffs_balloc_ufs2 (vp=0xfffffe006475cc30, startoffset=Variable "startoffset" is not available. ) at /usr/src/sys/ufs/ffs/ffs_balloc.c:647 #14 0xffffffff8065f1e9 in ffs_close_ea (vp=0xfffffe006475cc30, commit=Variable "commit" is not available. ) at /usr/src/sys/ufs/ffs/ffs_vnops.c:1076 #15 0xffffffff8065f7d7 in ffs_setextattr (ap=0xffffff809097e850) at /usr/src/sys/ufs/ffs/ffs_vnops.c:1749 #16 0xffffffff806fd349 in VOP_SETEXTATTR_APV (vop=0xffffffff80a3d900, a=0xffffff809097e850) at vnode_if.c:3294 #17 0xffffffff804ca399 in extattr_set_vp (vp=0xfffffe006475cc30, attrnamespace=2, attrname=0xffffff809097e9d0 "md5", data=Variable "data" is not available. ) at vnode_if.h:1480 #18 0xffffffff804ca6c3 in sys_extattr_set_file (td=0xfffffe006d2bb920, uap=0xffffff809097ebb0) at /usr/src/sys/kern/vfs_extattr.c:276 #19 0xffffffff806b3610 in amd64_syscall (td=0xfffffe006d2bb920, traced=0) at subr_syscall.c:135 -- wbr, pluknet