From nobody Tue Jul 18 05:47:09 2023 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 4R4nyj5PHcz4nb8B; Tue, 18 Jul 2023 05:47:09 +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 4R4nyj4zgfz3K28; Tue, 18 Jul 2023 05:47:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689659229; 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=Vy76wAWbD8Xu7TNmMYHabj2xMWdAmATbCBoESeHYM4U=; b=Io69zMkqsb/7bzIwWnM7Ka4H5P6e29kgeoFHuc7zgcRnF3m3cpZcg5dbqWWMK0t72ee5Pj bgTSq0cNYlGizbhNin8C2bwgSf1xzNteCfNDWlXWPniN98m0+045NFPGLQ5y224XqsDg9L tSFSg1JlJcFNhVXJn9CJ3R5dKW11wj1C659JjoWwxkZVDJ85vl5NuQVUaLuwRvjCLAMYTF gikLUkRMaxMxkonPoURIFpbzp6/P4DbR3YPS7o0Jfv6BxgwpIRM5E5yBSkS9PnlhtWmaBI jlkBfld6W6RKLTsrRn1PNkaEwTONYt99hn9LCJhFg3dmBrGnh4pfWACeGYu+oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689659229; 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=Vy76wAWbD8Xu7TNmMYHabj2xMWdAmATbCBoESeHYM4U=; b=cm4ir73tI60bWYjIIsbUPeqUg7cugbBVz+iaqnEwaSRjzh8oIALLCO4hV8RfvB7HUTeJlM y6xdpluD7aot3cE/zxpAKt1hBSjDzEHf+91MwJ+3HbZAN35ZzhBe2yev1vOblBDs0+fkA+ 0/07Ed+QyuWvW9ATBBbwGq7RcOD0Cc1U21ts/WOZKAoXaoeTjQkVFbZ9CmlPp4qHVb3n41 7aAQhHYUREuG9o86mdAKqtncndI4/QlsdnmDg6bUxiLxfcMxrgJSbiMZjayT+MbiHk29Qd w+8umaKmHlKMkwarj8sJoou9jl2LaXX9+bCsk0qSz/fGhWpaJSoFeOSZzGJnkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689659229; a=rsa-sha256; cv=none; b=FFkxxorKB3k0jHWviIK+TSn8PnZ+SrvriywFKprqF2izKpiVtppQ6cZvjqzGMmvMUQbFj1 ECyplhCelDiyG7NnLEIQCYo8hMfNsLx3CzBbr1s38yPfBcjl3hX2h5vtCmn+XJz6X57nFY PAEgj/+U6WQ3nsx/98EPcN18i0Tp6rYxWRrQjwwb4OZn/ojHwHwEBordThF7NlWvx1sZQ/ 3QnYUcnz2Mlg+hyDHPva41KtCzIQdVwb019xj3Y/8N5f1wH8K2JQY99a7ks7YwxCWhtqpc gZxytSfP2UXMVi2hsOu2ukFsINVznGz33XnGiiM1758zv1KGY+i45ssnYW8hCg== 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 4R4nyj435mztMP; Tue, 18 Jul 2023 05:47:09 +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 36I5l9hp072129; Tue, 18 Jul 2023 05:47:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36I5l9Zj072128; Tue, 18 Jul 2023 05:47:09 GMT (envelope-from git) Date: Tue, 18 Jul 2023 05:47:09 GMT Message-Id: <202307180547.36I5l9Zj072128@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: 868f3eadc5e0 - stable/13 - msdosfs: zero partially valid extended cluster 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: 868f3eadc5e0b50863c13457074ac1a0b03958dd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=868f3eadc5e0b50863c13457074ac1a0b03958dd commit 868f3eadc5e0b50863c13457074ac1a0b03958dd Author: Konstantin Belousov AuthorDate: 2023-07-06 01:51:07 +0000 Commit: Konstantin Belousov CommitDate: 2023-07-18 05:46:13 +0000 msdosfs: zero partially valid extended cluster (cherry picked from commit 7e4c6b2163fbed6be92b1e19f0eec4da973cfaec) --- 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 59107a6ca2ea..0c58fb4396ce 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -496,6 +496,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; @@ -534,13 +535,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())