Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Hyunchul Lee <hyc.lee@gmail.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: Hyunchul Lee <hyc.lee@gmail.com>,
	Baolin Liu <liubaolin@kylinos.cn>,
	ntfs@lists.linux.dev, stable@vger.kernel.org
Subject: [PATCH 2/4] ntfs: stop processing after a decompression failure
Date: Fri,  4 Dec 2026 14:54:40 +0900	[thread overview]
Message-ID: <20261204055442.3619912-2-hyc.lee@gmail.com> (raw)
In-Reply-To: <20261204055442.3619912-1-hyc.lee@gmail.com>

After a decompression failure, ntfs_read_compressed_block() logged
"Skipping this compression block." and continued to the next block
with "if (nr_cbs) goto do_next_cb;" using the callee-updated
cur_page/cur_ofs. These describe the failure point inside the failed
block, not the next block's own start, so every remaining block would
be processed shifted backward and the unwritten tail of the failed
block would never be filled.

With cb_size < PAGE_SIZE, the only case with more than one block, the
whole read covers the single page containing the failed block, so the
page can never complete and processing the rest is wasted work.

Stop the read (nr_cbs = 0), let the existing release loop free the
unfinished pages, and return the decompression error. This also
stops the read for any error exit that may be added to
ntfs_decompress() in the future.

Fixes: 1e9ea7e04472 ("Revert "fs: Remove NTFS classic"")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
---
 fs/ntfs/compress.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c
index 86381ca2b878..eb2538b4c713 100644
--- a/fs/ntfs/compress.c
+++ b/fs/ntfs/compress.c
@@ -804,7 +804,7 @@ int ntfs_read_compressed_block(struct folio *folio)
 		 */
 		if (err) {
 			ntfs_error(vol->sb,
-				"ntfs_decompress() failed in inode 0x%llx with error code %i. Skipping this compression block.",
+				"ntfs_decompress() failed in inode 0x%llx with error code %i.",
 				ni->mft_no, -err);
 			/* Release the unfinished pages. */
 			for (; prev_cur_page < cur_page; prev_cur_page++) {
@@ -817,6 +817,7 @@ int ntfs_read_compressed_block(struct folio *folio)
 					pages[prev_cur_page] = NULL;
 				}
 			}
+			nr_cbs = 0;
 		}
 	}
 
-- 
2.43.0


  reply	other threads:[~2026-12-04  5:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  5:54 [PATCH 1/4] ntfs: validate phrase output before advancing Hyunchul Lee
2026-12-04  5:54 ` Hyunchul Lee [this message]
2026-12-04  5:54 ` [PATCH 3/4] ntfs: zero hole-filled pages above initialized_size Hyunchul Lee
2026-12-04  5:54 ` [PATCH 4/4] ntfs: treat compression blocks beyond EOF as sparse Hyunchul Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204055442.3619912-2-hyc.lee@gmail.com \
    --to=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=liubaolin@kylinos.cn \
    --cc=ntfs@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox