Re: panic: condition seqc_in_modify(_vp->v_seqc) not met at zfs_acl.c:1147 (zfs_acl_chown_setattr)

2021-02-27 Thread Andriy Gapon
On 16/02/2021 22:38, Mateusz Guzik wrote:
> 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.


This patch works perfectly for me.
Thank you!

> 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)
 0xf8013e4e85b8: type VDIR
 usecount 1, writecount 0, refcount 1 seqc users 0 mountedhere 0
 hold count flags ()
 flags ()
 lock type zfs: EXCL by thread 0xfe01dd1cd560 (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  0x8036fd21 in zfs_acl_chown_setattr (zp=0xf801ccd203b0)
 at
 /usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c:1147
 #5  0x8037e52d in zfs_setattr (zp=0xf8024b04f760,
 vap=vap@entry=0xfe029a36c870, flags=flags@entry=0,
 cr=, cr@entry=0xf8003ecedc00)
 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
>>
> 
> 


-- 
Andriy Gapon
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: panic: condition seqc_in_modify(_vp->v_seqc) not met at zfs_acl.c:1147 (zfs_acl_chown_setattr)

2021-02-16 Thread Mateusz Guzik
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)
>>> 0xf8013e4e85b8: type VDIR
>>> usecount 1, writecount 0, refcount 1 seqc users 0 mountedhere 0
>>> hold count flags ()
>>> flags ()
>>> lock type zfs: EXCL by thread 0xfe01dd1cd560 (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  0x8036fd21 in zfs_acl_chown_setattr (zp=0xf801ccd203b0)
>>> at
>>> /usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c:1147
>>> #5  0x8037e52d in zfs_setattr (zp=0xf8024b04f760,
>>> vap=vap@entry=0xfe029a36c870, flags=flags@entry=0,
>>> cr=, cr@entry=0xf8003ecedc00)
>>> 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 
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: panic: condition seqc_in_modify(_vp->v_seqc) not met at zfs_acl.c:1147 (zfs_acl_chown_setattr)

2021-02-16 Thread Andriy Gapon
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)
>> 0xf8013e4e85b8: type VDIR
>> usecount 1, writecount 0, refcount 1 seqc users 0 mountedhere 0
>> hold count flags ()
>> flags ()
>> lock type zfs: EXCL by thread 0xfe01dd1cd560 (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  0x8036fd21 in zfs_acl_chown_setattr (zp=0xf801ccd203b0)
>> at 
>> /usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c:1147
>> #5  0x8037e52d in zfs_setattr (zp=0xf8024b04f760,
>> vap=vap@entry=0xfe029a36c870, flags=flags@entry=0,
>> cr=, cr@entry=0xf8003ecedc00)
>> 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
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: panic: condition seqc_in_modify(_vp->v_seqc) not met at zfs_acl.c:1147 (zfs_acl_chown_setattr)

2021-02-15 Thread Andriy Gapon
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)
> 0xf8013e4e85b8: type VDIR
> usecount 1, writecount 0, refcount 1 seqc users 0 mountedhere 0
> hold count flags ()
> flags ()
> lock type zfs: EXCL by thread 0xfe01dd1cd560 (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  0x8036fd21 in zfs_acl_chown_setattr (zp=0xf801ccd203b0)
> at 
> /usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c:1147
> #5  0x8037e52d in zfs_setattr (zp=0xf8024b04f760,
> vap=vap@entry=0xfe029a36c870, flags=flags@entry=0,
> cr=, cr@entry=0xf8003ecedc00)
> 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.

-- 
Andriy Gapon
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


panic: condition seqc_in_modify(_vp->v_seqc) not met at zfs_acl.c:1147 (zfs_acl_chown_setattr)

2021-02-15 Thread Andriy Gapon


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)
0xf8013e4e85b8: type VDIR
usecount 1, writecount 0, refcount 1 seqc users 0 mountedhere 0
hold count flags ()
flags ()
lock type zfs: EXCL by thread 0xfe01dd1cd560 (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!

(kgdb) #0  doadump (textdump=textdump@entry=1)
at /usr/devel/git/trant/sys/kern/kern_shutdown.c:399
#1  0x8083bea2 in kern_reboot (howto=260)
at /usr/devel/git/trant/sys/kern/kern_shutdown.c:486
#2  0x8083c4f7 in vpanic (
fmt=0x80c33e58 "condition %s not met at %s:%d (%s)",
ap=0xfe029a36c2c0)
at /usr/devel/git/trant/sys/kern/kern_shutdown.c:919
#3  0x8083c0a3 in panic (fmt=)
at /usr/devel/git/trant/sys/kern/kern_shutdown.c:843
#4  0x8036fd21 in zfs_acl_chown_setattr (zp=0xf801ccd203b0)
at 
/usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c:1147
#5  0x8037e52d in zfs_setattr (zp=0xf8024b04f760,
vap=vap@entry=0xfe029a36c870, flags=flags@entry=0,
cr=, cr@entry=0xf8003ecedc00)
at
/usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c:2758
#6  0x803817ee in zfs_freebsd_setattr (ap=)
at
/usr/devel/git/trant/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c:4918
#7  0x80ba6087 in VOP_SETATTR_APV (
vop=0x80e59280 , a=a@entry=0xfe029a36ca00)
at vnode_if.c:927
#8  0x80915a89 in VOP_SETATTR (vp=vp@entry=0xf8016524d5b8,
vap=vap@entry=0xfe029a36ca30, cred=,
cred@entry=0xf8003ecedc00) at ./vnode_if.h:485
#9  0x80915d67 in setfown (td=,
cred=0xf8003ecedc00, vp=0xf8016524d5b8, uid=uid@entry=4294967295,
gid=gid@entry=20) at /usr/devel/git/trant/sys/kern/vfs_syscalls.c:2942
#10 0x80915eb6 in kern_fchownat (td=0xfe01dd1cd560,
fd=fd@entry=-100,
path=0x803697858 ,
pathseg=pathseg@entry=UIO_USERSPACE, uid=-1, gid=, flag=0)
at /usr/devel/git/trant/sys/kern/vfs_syscalls.c:3002
#11 0x80915db6 in sys_chown (td=, uap=)
at /usr/devel/git/trant/sys/kern/vfs_syscalls.c:2962
#12 0x80b25b69 in syscallenter (td=0xfe01dd1cd560)
at /usr/devel/git/trant/sys/amd64/amd64/../../kern/subr_syscall.c:189
#13 0x80b25845 in amd64_syscall (td=0xfe01dd1cd560, traced=0)
at /usr/devel/git/trant/sys/amd64/amd64/trap.c:1156

-- 
Andriy Gapon
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"