From nobody Sat Nov 18 19:08:56 2023 X-Original-To: dev-commits-src-all@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 4SXjx44lKnz51V1x; Sat, 18 Nov 2023 19:08:56 +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 4SXjx449tkz4JRj; Sat, 18 Nov 2023 19:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700334536; 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=ZyirSjhyqDeboGofibNpAwCz2ztaZ/QL4evYGtSMUEc=; b=Hb5svv/osFDUyxqCSA0K5EKXHLavGaLSeIzUZ/9Ul0krI8DKSPvpQzJ0tpe6Ew/LKAzGjW Fm+keWxYLB03ZEEr5bu0v7tQPawa1MxpsFU0yB66QKmQ9bolsMtBJc2OoQW66ec/Yu2mr4 lg9dVy7JTs4yukRBCivo69E00Wl32w9tc2YZ4sj6uFZ+9EFsNcmXdDqf1p0uiCw4brGOQg NE23WD2nWK+bYBa5ALzT27MXNzcnoLCgh8O2dWBr3zgm0aprSaQfP0o90qvwDZkWRZn7+B rs4/U9v7aC2gwQDH3fsouM0/m3pbKbwZ7HB5n7a5gcJK2YGCRFxtrUPGjaiX3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700334536; 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=ZyirSjhyqDeboGofibNpAwCz2ztaZ/QL4evYGtSMUEc=; b=wJnacR2qIHhjh5FPxX9jiTQLhUopNW5mzBQEKDrvZTyYxRz3F8CfW41s8Hx8RppWWsxu/a 2Gazl/w1taCs1O28ts4xt3hAFpG4Yb/4L1RbwFkoSyTm3jdC1S6ZWLODLovGzwlwahg4zL 0XPVdOX0fxaj1nDDldBc0GWdHUt0jtObekqgkOU5EcyHb9xr2rBKVUjeWu8ki5nbO9AmV1 9bm10T+yf/lPCla80d1OJZAZvtV+7hZrUee98NjHe+XGTSp95IsdLub4dy3JKMnDJasvJ5 tvfVdycOv/Ahaj1K/BKnJkHYYZhNYv24GS2cj+wu1ZADlrDGIHyqb3Ly2ks9Hw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700334536; a=rsa-sha256; cv=none; b=NLBTRD7nO5n9P3twJ7NVJ7ZsjrNvtgqKK5j5W/UuFScza8nFSVk7k2WwqafEZl0e0Gg1VI Kg1SUavVbh06oWXsfeYVgM6jGGYKSwctYF5aWI1yQKoA8VeY2D2EKibvuCrtkv/EyiKyuR MCN1qAnQU3SoJ4gbWl2FaSuqJeUxQmKTcTK4Zov+PSFqnXGyBJIVtw6sTmd6MTqcK7JkDQ HiJIdy26me539EI6DQJOgvXvEVFn1Iubiu5VfaLjl7SvKigiGOkSO3o/lYSMNET8nOGXXX QeT02MsjqZ9HvfRg86tZBt4lAtIbsHvKyklwu/LQ44mwfWg5ibIVKgBoTmZv4A== 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 4SXjx43FMmzdg8; Sat, 18 Nov 2023 19:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AIJ8u8B081887; Sat, 18 Nov 2023 19:08:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AIJ8ugP081884; Sat, 18 Nov 2023 19:08:56 GMT (envelope-from git) Date: Sat, 18 Nov 2023 19:08:56 GMT Message-Id: <202311181908.3AIJ8ugP081884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 3eed4803f943 - main - vfs mount: Consistently use ENODEV internally for an invalid fstype List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3eed4803f943e2937325e81140b88e2e8eea8deb Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3eed4803f943e2937325e81140b88e2e8eea8deb commit 3eed4803f943e2937325e81140b88e2e8eea8deb Author: John Baldwin AuthorDate: 2023-11-18 19:08:34 +0000 Commit: John Baldwin CommitDate: 2023-11-18 19:08:34 +0000 vfs mount: Consistently use ENODEV internally for an invalid fstype Change vfs_byname_kld to always return an error value of ENODEV to indicate an unsupported fstype leaving ENOENT to indicate errors such as a missing mount point or invalid path. This allows nmount(2) to better distinguish these cases and avoid treating a missing device node as an invalid fstype after commit 6e8272f317b8. While here, change mount(2) to return EINVAL instead of ENODEV for an invalid fstype to match nmount(2). PR: 274600 Reviewed by: pstef, markj Differential Revision: https://reviews.freebsd.org/D42327 --- sys/kern/vfs_init.c | 4 +++- sys/kern/vfs_mount.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index c57e1471e356..64263caaef98 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -149,8 +149,10 @@ vfs_byname_kld(const char *fstype, struct thread *td, int *error) loaded = (*error == 0); if (*error == EEXIST) *error = 0; - if (*error) + if (*error) { + *error = ENODEV; return (NULL); + } /* Look up again to see if the VFS was loaded. */ vfsp = vfs_byname(fstype); diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 1a559bfd998e..10b29b569cc5 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -996,7 +996,7 @@ vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions) jail_export = false; error = vfs_domount(td, fstype, fspath, fsflags, jail_export, &optlist); - if (error == ENOENT) { + if (error == ENODEV) { error = EINVAL; if (errmsg != NULL) strncpy(errmsg, "Invalid fstype", errmsg_len); @@ -1086,7 +1086,7 @@ sys_mount(struct thread *td, struct mount_args *uap) vfsp = vfs_byname_kld(fstype, td, &error); free(fstype, M_TEMP); if (vfsp == NULL) - return (ENOENT); + return (EINVAL); if (((vfsp->vfc_flags & VFCF_SBDRY) != 0 && vfsp->vfc_vfsops_sd->vfs_cmount == NULL) || ((vfsp->vfc_flags & VFCF_SBDRY) == 0 &&