From owner-freebsd-current@freebsd.org Tue Feb 16 20:38:53 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02F2C548E78; Tue, 16 Feb 2021 20:38:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgCVh2Flhz3N46; Tue, 16 Feb 2021 20:38:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x429.google.com with SMTP id b3so14934439wrj.5; Tue, 16 Feb 2021 12:38:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=iGd+8BpkhSHf8cNB2VsjeYXmpDzwRF7TGyCD5H5cRwY=; b=RokdnjYuZd6JKohvRHku9lidHu66xXmpTEkiF+uNGEP78/aClKoAlfyS6R5vxNYSKF AIRCDz+mSTndnsDdH/Ae/bm392G4Fkzx4P1RtTT5HQBJJm7x+aDDu7SxeV7jGvBfdU8t 6we6NkAlOCqxwuUxEFydBi8AywWdPDdnojCnvr2Xg6bzLZjmFx4jEd9zz4+9686EeVvK j60OgJKqMd4V3akGQJyr+ZgSmVvIzLyA0gT0xyciAz0YI+BVLIJuUvdb+xap/JYcZtJq 8kisH1tBn1ka7wYQhShKCWagvyY6MoKKqDDGt4kXv6hHuIBwy5HgPEuOzgSM/hEZeV7P nbng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=iGd+8BpkhSHf8cNB2VsjeYXmpDzwRF7TGyCD5H5cRwY=; b=tJKDAQIC9zZ45p+cJ+Xn0nFvdOjyMH1ykDXH0940zF2oTAVze3DhM5C6po3au+Ju1D EcNWby19xAG/HzSC31ruQBA+9J9Of5kBiVYC5qMJwSlGBBd7mZ07SHxwChJ/4dsSW6Eq 555C4SWIdkCOss7SCuNT/ki49CElbGedWCGFvfyn50ENCESKmU52syR8ioqvwUYV9AYq I18Ch0/7riPoGNK8z7kCrQAUJqrhsBIyEvTgOszSQYSzbjzA1jozoimSdrzlEz6skWQ3 gTp3HVR/VMQp1jj6vF2OBuoe5Uf+vzgiLJT1SBDRYUxoY0VZZzaTwWe2b7oS6mUQ5xOs SKKQ== X-Gm-Message-State: AOAM531BU+i5cGwaLUk2JVCPDfWjrDBz3hXaRW5aCaEtk6WLknzsww6i 9rb6oWnKSol1ixiQ/fDJjpVPyQDRGV0KEycbUZDt0D48 X-Google-Smtp-Source: ABdhPJwbg5bwXZStriNmNm82VcnkQhUW0I1W7wayhqUQgJLjNCNceDAptDVgl+WamZouS2KHdNWX8VX84BprgrJv6so= X-Received: by 2002:a05:6000:1565:: with SMTP id 5mr25711315wrz.109.1613507929501; Tue, 16 Feb 2021 12:38:49 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:e406:0:0:0:0:0 with HTTP; Tue, 16 Feb 2021 12:38:48 -0800 (PST) In-Reply-To: <8f944450-734d-e70b-c1fb-10d2239576e2@FreeBSD.org> References: <1b261679-3492-dda8-614e-21150a2375d8@FreeBSD.org> <038304d0-2cd0-f089-56ee-c094cdc4cc21@FreeBSD.org> <8f944450-734d-e70b-c1fb-10d2239576e2@FreeBSD.org> From: Mateusz Guzik Date: Tue, 16 Feb 2021 21:38:48 +0100 Message-ID: Subject: Re: panic: condition seqc_in_modify(_vp->v_seqc) not met at zfs_acl.c:1147 (zfs_acl_chown_setattr) To: Andriy Gapon Cc: FreeBSD Current , freebsd-fs@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DgCVh2Flhz3N46 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=RokdnjYu; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::429 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::429:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::429:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::429:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-current,freebsd-fs]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 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: Tue, 16 Feb 2021 20:38:53 -0000 I think for future proofing it would be best if all vnodes going there had seqc marked, thus I think this should do the trick: diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index d5f0da9ecd4b..8172916c4329 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -2756,7 +2756,9 @@ zfs_setattr(znode_t *zp, vattr_t *vap, int flags, cred_t *cr) err = zfs_acl_chown_setattr(zp); ASSERT(err == 0); if (attrzp) { + vn_seqc_write_begin(ZTOV(attrzp)); err = zfs_acl_chown_setattr(attrzp); + vn_seqc_write_end(ZTOV(attrzp)); ASSERT(err == 0); } } I don't see other calls to the routine. On 2/16/21, Andriy Gapon wrote: > On 15/02/2021 11:45, Andriy Gapon wrote: >> On 15/02/2021 10:22, Andriy Gapon wrote: >>> >>> I've got this panic once when copying a couple of files. >>> The system is stable/13 as of 1996360d7338d, a custom kernel >>> configuration, but >>> no local source code modifications. >>> >>> Unread portion of the kernel message buffer: >>> VNASSERT failed: ({ seqc_t __seqc = (_vp->v_seqc); >>> __builtin_expect((__seqc & >>> 1), 0); }) not true at >>> /usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c:1147 >>> (zfs_acl_chown_setattr) >>> 0xfffff8013e4e85b8: type VDIR >>> usecount 1, writecount 0, refcount 1 seqc users 0 mountedhere 0 >>> hold count flags () >>> flags () >>> lock type zfs: EXCL by thread 0xfffffe01dd1cd560 (pid 30747, >>> kdeinit5, tid >>> 159911) >>> panic: condition seqc_in_modify(_vp->v_seqc) not met at >>> /usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c:1147 >>> (zfs_acl_chown_setattr) >>> >>> Any ideas, suggestions, hints? >>> Thanks! >>> >> ... >>> #4 0xffffffff8036fd21 in zfs_acl_chown_setattr (zp=0xfffff801ccd203b0) >>> at >>> /usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c:1147 >>> #5 0xffffffff8037e52d in zfs_setattr (zp=0xfffff8024b04f760, >>> vap=vap@entry=0xfffffe029a36c870, flags=flags@entry=0, >>> cr=, cr@entry=0xfffff8003ecedc00) >>> at >>> /usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c:2758 >> >> So, this is actually the second zfs_acl_chown_setattr call here: >> err = zfs_acl_chown_setattr(zp); >> ASSERT(err == 0); >> if (attrzp) { >> err = zfs_acl_chown_setattr(attrzp); >> ASSERT(err == 0); >> } >> >> I am not sure if the assertion is actually applicable to attrzp (extended >> attributes "directory"). >> At least I do not see any seq calls for it. >> > > So, I think that the problem should be reproducible by simply chown-ing a > file > with an extended attribute. The kernel should be compiled with both > DEBUG_VFS_LOCKS and INVARIANTS. > > -- > Andriy Gapon > -- Mateusz Guzik