[patch] ufs extattr panic w/ quota under DIAGNOSTIC

Sergey Kandaurov pluknet at gmail.com
Mon Apr 9 11:58:58 UTC 2012


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


More information about the freebsd-fs mailing list