From nobody Mon Sep 11 18:50:28 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 4Rkwl86qznz4tLLJ; Mon, 11 Sep 2023 18:50:28 +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 4Rkwl85Ss1z3Rnl; Mon, 11 Sep 2023 18:50:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694458228; 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=rEMdPyZKbYGK2hSh3krev31BQT8FYC4+KfDd1pq/HmU=; b=JRedIZLEMV0rPDizNNwhVofNUJI/tqmqsp8qR94rubpS2PGn2MdqWY9JABE7qZtyVBbOAE ncvRbrbd1SckTl95gcWGf6m8jz+B8T9znjv3ZwyGy+YdAbT9yo2GUoy1b3xKbi9OTgGK41 m6nRUFCesnU9ztWZ+LWscipNViqHs1l+EeMtRr86b43Z8abYGuQk5TQqhipmz4X+Eh0etS 6es1wJDhie+VRwYA7ExDox3E5CfmtgzKessdHmc+MYVau6LTKeLuC4JXRzM3RQ2VCSYlWc gg5IkcbeI7tcid8889JtcPvX9Ez14FR/i+MOZlrmsTxSPzRMMHc0aey03Uov8A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694458228; a=rsa-sha256; cv=none; b=AmNOXu//8MJo0Ypk/GhsPNTW8FBre0Y7HPnHwm8FX0HMP3QaHtlF8FP7DmDTPr6jXSWTZk tgqfgZ32g/RmNTdRfxAfAZeUxObqCeCUZlUUEOiyY43Cs/0XGNKb/BEzi3FkMZT2BSN+c8 y6CBBRthPNWuXyGc+12v3jozy39rBb9h651LJLr6QyB3SfoiEkzWaNbY824tnPCU5qPXu9 2g8+qtNLaooHLPAf+EX2mFTn/n9u4YJrfuKGTjfSkdX2IZh9j8OvNb5ratgLOevZikn8hn dfxOspQtG8iFNZjlfo+jvjiS9D3S46UF035HRKba/AoPggcP5AZH3JvMg57KEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694458228; 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=rEMdPyZKbYGK2hSh3krev31BQT8FYC4+KfDd1pq/HmU=; b=tWrJfIkY0ohNTXblWVDLf/qgs5Bzn4slD0s6Xt7mdxs1AcrJ1jJ+QRlV1i1VVCLz2WfE6g 8lI6yJIM6rRPElKXEZMOTGxplDe7z6CF8KrnFCnp7qq8mrz0X8ZV/XWsoo4txdOR2fIVpW AymSGTt6xROPdIYlqOPwKl5i9dQtM3AfsCvW0YDefKh7ZlNQWIAvKjPLm5tGYwHc5Js66N MTpHjjJXPweTcu/jBsSnJh8Pnq6zFY1bvKxcgT/kxZUbLTNzvcLew/oocO/GajVt86wlYZ zcoYKOjtURGA6vS7jVOO6GKuJfCqJEMWln/j/c9Ve1aler+MmT4/HvIYuC0xGA== 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 4Rkwl84ZNbz10dH; Mon, 11 Sep 2023 18:50:28 +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 38BIoSxl083263; Mon, 11 Sep 2023 18:50:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38BIoSAR083260; Mon, 11 Sep 2023 18:50:28 GMT (envelope-from git) Date: Mon, 11 Sep 2023 18:50:28 GMT Message-Id: <202309111850.38BIoSAR083260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 79802c179a5d - stable/12 - msdosfs: zero partially valid extended cluster 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 79802c179a5de367a0c16b07e746b280d4813a2c Auto-Submitted: auto-generated The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=79802c179a5de367a0c16b07e746b280d4813a2c commit 79802c179a5de367a0c16b07e746b280d4813a2c Author: Konstantin Belousov AuthorDate: 2023-07-06 01:51:07 +0000 Commit: Ed Maste CommitDate: 2023-09-11 18:05:09 +0000 msdosfs: zero partially valid extended cluster (cherry picked from commit 7e4c6b2163fbed6be92b1e19f0eec4da973cfaec) (cherry picked from commit 868f3eadc5e0b50863c13457074ac1a0b03958dd) --- sys/fs/msdosfs/msdosfs_denode.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 57d1c96a561b..3b4e809d6196 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -477,6 +477,7 @@ deextend(struct denode *dep, u_long length, struct ucred *cred) struct msdosfsmount *pmp = dep->de_pmp; struct vnode *vp = DETOV(dep); struct buf *bp; + off_t eof_clusteroff; u_long count; int error; @@ -515,13 +516,19 @@ deextend(struct denode *dep, u_long length, struct ucred *cred) * B_CACHE | B_DELWRI but with invalid pages, and cannot be * neither written out nor validated. * - * Fix it by proactively clearing extended pages. + * Fix it by proactively clearing extended pages. Need to do + * both vfs_bio_clrbuf() to mark pages valid, and to zero + * actual buffer content which might exist in the tail of the + * already valid cluster. */ error = bread(vp, de_cluster(pmp, dep->de_FileSize), pmp->pm_bpcluster, NOCRED, &bp); if (error != 0) goto rewind; vfs_bio_clrbuf(bp); + eof_clusteroff = de_cn2off(pmp, de_cluster(pmp, dep->de_FileSize)); + vfs_bio_bzero_buf(bp, dep->de_FileSize - eof_clusteroff, + pmp->pm_bpcluster - dep->de_FileSize + eof_clusteroff); if (!DOINGASYNC(vp)) (void)bwrite(bp); else if (vm_page_count_severe() || buf_dirty_count_severe())