From nobody Tue Jul 12 23:12:29 2022 X-Original-To: freebsd-hackers@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 30A0C1D23BD3 for ; Tue, 12 Jul 2022 23:24:21 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from midget.dons.net.au (2403-5800-5200-4700-225-90ff-fe47-39b4.ip6.aussiebb.net [IPv6:2403:5800:5200:4700:225:90ff:fe47:39b4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "dons.net.au", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LjGzm4N68z3Wq5 for ; Tue, 12 Jul 2022 23:24:20 +0000 (UTC) (envelope-from darius@dons.net.au) Received: from midget.dons.net.au (localhost [127.0.0.1]) by midget.dons.net.au (8.17.1/8.16.1) with ESMTPS id 26CNCefq035964 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Wed, 13 Jul 2022 08:42:50 +0930 (ACST) (envelope-from darius@dons.net.au) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dons.net.au; s=default; t=1657667573; bh=36mwhPAhRpTbgKn9j9oyBJNbE5WTSslwHGqPBEQ7/sI=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=KRMpkzvyNI2qIAcFo3nbTA6i//nzxoUzyYKVfltaiD7erErSp7DR4qZB/+KAx1+xC y4cb7hztteKtQprsIxiRtkB3D6OvQGb+fOOMs2RsDLCMVoz74vnZGMs1qCIygssn76 KK+XSkBh8aR8QcpJJVWi6t8Okq3LQPOWQeh+VU4c= Received: (from mailnull@localhost) by midget.dons.net.au (8.17.1/8.16.1/Submit) id 26CNCa4F035960 for ; Wed, 13 Jul 2022 08:42:36 +0930 (ACST) (envelope-from darius@dons.net.au) X-MIMEDefang-Relay-a1a524833438212bf543e143edafb27bc4d2c346: 2403:5800:5200:4700:b9d9:fc6f:cbb1:cf48 Received: from smtpclient.apple ([IPv6:2403:5800:5200:4700:b9d9:fc6f:cbb1:cf48] [2403:5800:5200:4700:b9d9:fc6f:cbb1:cf48]) by 2403-5800-5200-4700-225-90ff-fe47-39b4.ip6.aussiebb.net (envelope-sender ) (MIMEDefang) with ESMTP id 26CNCaLe035954; Wed, 13 Jul 2022 08:42:36 +0930 Content-Type: text/plain; charset=us-ascii List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Re: VFS mount rollback for virtio 9pfs From: "Daniel O'Connor" In-Reply-To: Date: Wed, 13 Jul 2022 08:42:29 +0930 Cc: freebsd-hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <75ACE8B8-A41F-4742-95DA-3CFB3B97746A@dons.net.au> To: Mark Johnston X-Mailer: Apple Mail (2.3696.100.31) X-Spam-Score: 1.3 (*) No, score=1.3 required=5.0 tests=RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.5 X-Scanned-By: MIMEDefang 2.84 on 10.0.2.1 X-Rspamd-Queue-Id: 4LjGzm4N68z3Wq5 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=dons.net.au header.s=default header.b=KRMpkzvy; dmarc=pass (policy=quarantine) header.from=dons.net.au; spf=pass (mx1.freebsd.org: domain of darius@dons.net.au designates 2403:5800:5200:4700:225:90ff:fe47:39b4 as permitted sender) smtp.mailfrom=darius@dons.net.au X-Spamd-Result: default: False [-3.50 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[dons.net.au,quarantine]; R_DKIM_ALLOW(-0.20)[dons.net.au:s=default]; R_SPF_ALLOW(-0.20)[+mx:c]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-hackers]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[dons.net.au:+]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; ASN(0.00)[asn:4764, ipnet:2403:5800::/32, country:AU]; RCVD_COUNT_THREE(0.00)[4]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N > On 13 Jul 2022, at 00:03, Mark Johnston wrote: >> This was easily fixed but I want to make the handling of a similar = error in future correct. The virtfs_unmount code as it stands will fail = when the kernel tries to rollback the mount. The end result is the ref = count for the file system is not decremented so the KLD can't be = unloaded. >=20 > How does virtfs_unmount() fail? The tsleep() call there looks > suspicious, it's using the address of a local variable as a wait > channel, so I don't understand how it'll ever get signalled. Yes good point, I don't think it ever gets woken up - it just times out. Without any changes (ie what is in my git tree at now) it returns EBUSY. If I change it like so: if (mntflags & MNT_FORCE || mp->mnt_kern_flag & MNTK_UNMOUNTF) flags |=3D FORCECLOSE; And then later to squash the return value to 0 if FORCECLOSE is set then = mount hangs: load: 0.46 cmd: mount 988 [mntref] 1.42r 0.00u 0.03s 0% 2252k mi_switch+0xc2 _sleep+0x1fc vfs_mount_destroy+0xa4 = vfs_domount_first+0x382 vfs_domount+0x2ad vfs_donmount+0x8f8 = sys_nmount+0x69 amd64_syscall+0x10c fast_syscall_common+0xf8 -- Daniel O'Connor "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum