From nobody Wed Apr 13 23:47:24 2022 X-Original-To: dev-commits-src-main@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 AD25C1B32ABF; Wed, 13 Apr 2022 23:47:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Kdzlw4C8vz3lHk; Wed, 13 Apr 2022 23:47:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649893644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OOL3LAWIa16l4J9W26L4w9QqkJEO+oOdszwMmeEcZfg=; b=AKVVT6emBzg4bS5dmarIjH35pLfMl+AdoUJ9C3Et1plOoq8NHyDtVVqdNJIiohOrJJj5dr omELTKVppHy6EGcY23XmDYvpsrRTtVBT2D24ljwSqLkxTByiY34BAaUfcunLb1CFylQ1go SwN9eNGyT7YGO9uf/dCRq5W+xAE+b3kQjdGuVqA70VRB8Tk2jH7bQaTdzOxlJpIsdqjeKP Vw3xEy7PZlRTrEco4YuTu8BjIM5kzZ0hi6lMbetuTz9zR8Kk8JX1zzUCgtFMmW6cTj6Q5C AvS64zhSw/UuHdBnAGQBa1JMqTy5v06SQlcN8uUtQvxfr3u0czM6n6fbNKM7SQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C09A15AC0; Wed, 13 Apr 2022 23:47:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23DNlOR6028986; Wed, 13 Apr 2022 23:47:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23DNlOl6028985; Wed, 13 Apr 2022 23:47:24 GMT (envelope-from git) Date: Wed, 13 Apr 2022 23:47:24 GMT Message-Id: <202204132347.23DNlOl6028985@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: bf13db086b84 - main - Mostly revert a5970a529c2d95271: Make files opened with O_PATH to not block non-forced unmount List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf13db086b84c29ce901145f2800c561dcbf4d1e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649893644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OOL3LAWIa16l4J9W26L4w9QqkJEO+oOdszwMmeEcZfg=; b=aH1I+nMp0tbBBdm5V65jyqCspIbGmXb4WKcQOhFd9Q9dYHjOCBQ9INEWdDyWMzLKh9Mb0V QltVYrouNPE2b2DRtsn7ojZcSnyl5vT+FiM6qAh/K1f1jF1dMNSJvbLnARhbAC0w9TaFVa tg1LsMD/C+O057LbPVF44KpB55VjyotabBzpEY0KNK/M3a4FsTR3mtrMG62DzXl+zhTar+ dYbnIPkrj38LWNVEVK32p3Qx+AK+2r7Z5vFom/bzNZNCPxQVFnYdkLEbOql/W0jqf20jf6 SHe6smAEu/TUobfzfp344KfTCdmbrWaDYaPGYX6kUpjKQ2KvB2br6VW8lRjCAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649893644; a=rsa-sha256; cv=none; b=ga3dHS4QH8cQ4oj7vv1AvusYRWPRGkWgMKIcrtvm5Y/V9iDBNsMrw9wEicAPSHuhxs39pA ehMi7eaeYcnfia1bU4LwfbKX8sh3EQqz+LTawoKl+tRpn5xNFh2cKwcMKbMM6wxM3Keq8q 3xaE3mBlMlJZCGTbHv3Z5N6acev0uC7/Gplh3QGhARyMSz4Sw7YVbYfZhPzP7/sjGnXmF/ BJoToh7eXoJwiloaTpobhsEkOHm8hG3bra4rsy62PHMRGjPH1sxl/kYOtKsPT4FY/Ai+kS DNxyZ3emke06sJYZ6pL86AoEiSkD9ADfwxWmVJpQxMPR+C3aKB0YaC+l8gy4/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bf13db086b84c29ce901145f2800c561dcbf4d1e commit bf13db086b84c29ce901145f2800c561dcbf4d1e Author: Konstantin Belousov AuthorDate: 2022-04-13 00:47:45 +0000 Commit: Konstantin Belousov CommitDate: 2022-04-13 23:47:04 +0000 Mostly revert a5970a529c2d95271: Make files opened with O_PATH to not block non-forced unmount Problem is that open(O_PATH) on nullfs -o nocache is broken then, because there is no reference on the vnode after the open syscall exits. Reported and tested by: ambrisko Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/libc/sys/open.2 | 5 +---- sys/kern/kern_descrip.c | 2 +- sys/kern/vfs_syscalls.c | 2 -- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index f6b061079ddf..876a4ce1e57d 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd October 9, 2021 +.Dd April 22, 2022 .Dt OPEN 2 .Os .Sh NAME @@ -351,9 +351,6 @@ But operations like and any other that operate on file and not on file descriptor (except .Xr fstat 2 ), are not allowed. -File opened with the -.Dv O_PATH -flag does not prevent non-forced unmount of the volume it belongs to. .Pp A file descriptor created with the .Dv O_PATH diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index d88263ddeedb..740d777bcede 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -5138,7 +5138,7 @@ path_close(struct file *fp, struct thread *td) { MPASS(fp->f_type == DTYPE_VNODE); fp->f_ops = &badfileops; - vdrop(fp->f_vnode); + vrele(fp->f_vnode); return (0); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 77a9b9c25290..a41a12d08cf9 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1219,8 +1219,6 @@ kern_openat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, if ((flags & O_PATH) != 0) { finit(fp, (flags & FMASK) | (fp->f_flag & FKQALLOWED), DTYPE_VNODE, NULL, &path_fileops); - vhold(vp); - vunref(vp); } else { finit_vnode(fp, flags, NULL, &vnops); }