From nobody Sat Jan 15 00:51:45 2022 X-Original-To: dev-commits-src-branches@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 8B45E195189F; Sat, 15 Jan 2022 00:51:46 +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 4JbKPG0q7Vz4kY7; Sat, 15 Jan 2022 00:51:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207906; 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=VC2G5LD2huAxYl3RCsIV3BxnNMN8HGkfnzM8QvkTYIc=; b=YSoO2oEPtKEjm4Rv9eTQZZXaJsew9bruA5cjzaPSVB4e2enfqT7ODvWDSUixyGaLAX32YU +oxR52VIOu2OkxgpOEGnLi+kwqH4f6B4ZkT7zCVz0MZtlH+LtU3MJNFZhtu3lCTKOQ0MWv i8KtdlMNOACiNoczO7haHaEQR10aZKApW/WyfLddbTDt2ONSpzAlIsQKfMRGovLZUkRYvd SgJZnUI28e4NWfVYuzQSPkQPwLBGTis4h3OpAL1oEnU3AaFJl7hosUg6T9sQo6aYyFtCxY VJHm5yIJci/KlXaInlzeXG99gHXcbI3wP+bSbdO4IGAZjHG1Q/g9k35l6rOo8g== 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 A06D21DD1F; Sat, 15 Jan 2022 00:51:45 +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 20F0pjxK031302; Sat, 15 Jan 2022 00:51:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20F0pj8U031301; Sat, 15 Jan 2022 00:51:45 GMT (envelope-from git) Date: Sat, 15 Jan 2022 00:51:45 GMT Message-Id: <202201150051.20F0pj8U031301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1e74922c68d2 - stable/13 - msdosfs: on integrity error, fire a task to remount filesystem to ro List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1e74922c68d22840581d83d45a9c88cc0c8d4676 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207906; 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=VC2G5LD2huAxYl3RCsIV3BxnNMN8HGkfnzM8QvkTYIc=; b=XQz7G4K0sUc7olesy0J7aKkyX5qi4jKUsm7Uii4IZZZqTPjNdeTpmJoJDSI6eMiJvhurAg lwmZ+JwMwefNKxNNrMxzwwbh2G3pkoj4v7+y0rPtBlV89SI0soSmI5IGNw9//ntIyZ17+S H5WmbS9Ed0dEKCooZKBjHbIvbFwoq4JopwezF7odTqnKst3tXVg80QwrJuB2heLdzi0P7L NBToSoFKhK7vRHP3oOlNGCpoeFdbD1nVD2dIvdtlhlyo4xlcUhvikZhH+knroimn4Exdl1 l9iUEYWfLG+MTVLbYdzPlZfWj6DPpqm9gYpLx6dgeca8WO7EJvwepGROywg30g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642207906; a=rsa-sha256; cv=none; b=gQDx9W/8fDMcS9jOAJvrbkJtSftJ4j6ramox+ysH4Vb33yV1XHdaGdqyo7Zd9samgqR75T rTjo5TR0Kha20vtK6ET/OAtKOG9/yucMt6xpzZFu2/MGPkpXuh6gwJU9DbOXhWrZqZiLtI 0dpmA7gf92Wjzt5vBXw0Z7imp2+aMFK+OaXwCYsY8lBESRfVCd+I+Wifh/ZnyXq/DVCqK0 khZAP1W/1r0TlMEnbY3UwhfKpnuFhvOLmW4Zsfl7ZP/Qrk+XO2Vok/3bWbC/zdCgZcHXON lI+rDf0ANpSrUBmq+7Wdo1J8eXPH1eQSp+Kyp3qaEOgZmMcBO1DzxhXHBNQj8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1e74922c68d22840581d83d45a9c88cc0c8d4676 commit 1e74922c68d22840581d83d45a9c88cc0c8d4676 Author: Konstantin Belousov AuthorDate: 2021-12-25 19:45:47 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-14 18:11:02 +0000 msdosfs: on integrity error, fire a task to remount filesystem to ro (cherry picked from commit 41e85eeab90dec540c7aa3973ba601bae1f16c10) --- sys/fs/msdosfs/msdosfs_denode.c | 1 + sys/fs/msdosfs/msdosfs_fat.c | 1 + sys/fs/msdosfs/msdosfs_lookup.c | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index bdc7436079ea..6fba51708462 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -158,6 +158,7 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset, badoff: vgone(nvp); vput(nvp); + msdosfs_integrity_error(pmp); return (EBADF); } ldep = malloc(sizeof(struct denode), M_MSDOSFSNODE, M_WAITOK | M_ZERO); diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c index fc1db705989b..e6d9b671e7d7 100644 --- a/sys/fs/msdosfs/msdosfs_fat.c +++ b/sys/fs/msdosfs/msdosfs_fat.c @@ -412,6 +412,7 @@ usemap_free(struct msdosfsmount *pmp, u_long cn) printf("%s: Freeing unused sector %ld %ld %x\n", pmp->pm_mountp->mnt_stat.f_mntonname, cn, cn % N_INUSEBITS, (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]); + msdosfs_integrity_error(pmp); return (EINTEGRITY); } pmp->pm_freeclustercount++; diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c index e30866b5bedd..291f923d79fe 100644 --- a/sys/fs/msdosfs/msdosfs_lookup.c +++ b/sys/fs/msdosfs/msdosfs_lookup.c @@ -77,6 +77,7 @@ msdosfs_lookup_checker(struct msdosfsmount *pmp, struct vnode *dvp, */ if (vp == dvp) { vput(vp); + msdosfs_integrity_error(pmp); *vpp = NULL; return (EBADF); } @@ -595,10 +596,13 @@ foundroot: vput(*vpp); goto restart; } - return (msdosfs_lookup_checker(pmp, vdp, VTODE(*vpp), vpp)); + error = msdosfs_lookup_checker(pmp, vdp, VTODE(*vpp), vpp); + if (error != 0) + return (error); } else if (dp->de_StartCluster == scn && isadir) { if (cnp->cn_namelen != 1 || cnp->cn_nameptr[0] != '.') { /* fs is corrupted, non-dot lookup returned dvp */ + msdosfs_integrity_error(pmp); return (EBADF); } VREF(vdp); /* we want ourself, ie "." */