From nobody Tue Nov 14 17:47:46 2023 X-Original-To: current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SVDKJ3Jbjz50Q4Q for ; Tue, 14 Nov 2023 17:47:48 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SVDKJ1SxCz3bp7; Tue, 14 Nov 2023 17:47:48 +0000 (UTC) (envelope-from mjguzik@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6ce29d1db6eso305a34.1; Tue, 14 Nov 2023 09:47:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699984067; x=1700588867; darn=freebsd.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dWPV1qHe+GNzGSS8/W4DoZiyrJya5tsWYRS5IPiYtSs=; b=Tuuz4L1DuSZ/0c2monm9ifhQapMa1sg2vaJMSj62DsSpySTRcKZMUWvDexBrPAvC3V TzzYWl0VaklUA1GAkAfo+lEFfzJ4u7IzzsQG/cWXCL4PLIyvYUYYe4l4Le0M1GooCNHr M/oGB47O5swEmMpCwfMamACKg3MJRUdNt+BRs+za2T7We8lSjMP4c0ZjBv+R8x2lyk1Y IlMqy1bejGfm8NV8Q5ZSOLi/aO6h+/ae8Dux9AgnUtewmGiBenBEmnOuFNb+vJ7aScZ2 UkM4bfhpio0Nt+j0QQxqi72RRh0GJtlWoO13jsbx1dWjoCL8ixzYMgO9XHwXtu7rcnvr 33hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699984067; x=1700588867; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dWPV1qHe+GNzGSS8/W4DoZiyrJya5tsWYRS5IPiYtSs=; b=HaqsNiIyeRb6keyI3aP2hVL+Vosmlbr3dSV3wiQFeSgsbplYpDa6U5oJKcTuOFeg6L bHH28adWWfIzDIU85l11QiN06v5bErmxobzHVCQdnzZu6dQrFUG6tAk6qzj80xGfAKOQ QUWrmZRzOegdCywVm/S0UPBpFbCRPb6O5i2Q9ahu80vF147kt8E5ULpPmhtUMYgF69hD vhYrZy9eu5SM2j948pdIat9Bdo0LDMR3ywGggAc5AfqdtjlZ5AnrkDE44n0HWBaKAZel 4vMClwtIM6DrcyX/ELoudI0+HED9JCjS/I2PJJWn4Q/DJvR+vBtJCx+2QlcKxczTS2qm d9Rw== X-Gm-Message-State: AOJu0Yya3cRWS5xI27aJS/ZbBK6qwubC/DJn5PUQ3tzC7YhcgUMTSfZ0 Hi2P3fKwk0kKhfVFVyH7P5lllz+B40gOqb859MzRF3FKNf4= X-Google-Smtp-Source: AGHT+IH6I9NZ6BU0iLp5Wc7K8ct4U1xurbN396QNpoBV++XREMf8BmpoXe0vpQPYmJL2ITwF2O17fYIXvJGd8iOndfg= X-Received: by 2002:a05:6830:922:b0:6bd:9e1c:93a6 with SMTP id v34-20020a056830092200b006bd9e1c93a6mr1443421ott.0.1699984066724; Tue, 14 Nov 2023 09:47:46 -0800 (PST) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Received: by 2002:ac9:57d4:0:b0:4f0:1250:dd51 with HTTP; Tue, 14 Nov 2023 09:47:46 -0800 (PST) In-Reply-To: References: <349700057.3452.1699611152405@localhost> <1900239445.5968.1699966796547@localhost> From: Mateusz Guzik Date: Tue, 14 Nov 2023 18:47:46 +0100 Message-ID: Subject: Re: crash zfs_clone_range() To: Alexander Motin Cc: Ronald Klop , Konstantin Belousov , current@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4SVDKJ1SxCz3bp7 On 11/14/23, Alexander Motin wrote: > On 14.11.2023 12:39, Mateusz Guzik wrote: >> One of the vnodes is probably not zfs, I suspect this will do it >> (untested): >> >> 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 107cd69c756c..e799a7091b8e 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 >> @@ -6270,6 +6270,11 @@ zfs_freebsd_copy_file_range(struct >> vop_copy_file_range_args *ap) >> goto bad_write_fallback; >> } >> } >> + >> + if (invp->v_mount->mnt_vfc != outvp->v_mount->mnt_vfc) { >> + goto bad_write_fallback; >> + } >> + >> if (invp == outvp) { >> if (vn_lock(outvp, LK_EXCLUSIVE) != 0) { >> goto bad_write_fallback; >> > > vn_copy_file_range() verifies for that: > > /* > * If the two vnodes are for the same file system type, call > * VOP_COPY_FILE_RANGE(), otherwise call > vn_generic_copy_file_range() > * which can handle copies across multiple file system types. > */ > *lenp = len; > if (inmp == outmp || strcmp(inmp->mnt_vfc->vfc_name, > outmp->mnt_vfc->vfc_name) == 0) > error = VOP_COPY_FILE_RANGE(invp, inoffp, outvp, outoffp, > lenp, flags, incred, outcred, fsize_td); > else > error = vn_generic_copy_file_range(invp, inoffp, outvp, > outoffp, lenp, flags, incred, outcred, fsize_td); > > The crash at hand comes from nullfs. If "outward" vnodes are both nullfs, but only one underlying vnode is zfs, you get the above. -- Mateusz Guzik