Skip to contentSkip to conversation

exfat: check the emergency state in exfat_writeback_range()

PATCH RESEND In review Sasha Levin 2 participants 2 messages Nov 24

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 exfat: check the emergency state in exfat_writeback_range()

Since next-20261119 the merge of the vfs-brauner tree with the exfat tree drops an error check from exfat writeback.

Commit 788f21d1f192 ("exfat: don't set SB_RDONLY after filesystem errors") in the vfs-brauner tree switches the write side shutdown checks to exfat_emergency_state(), which also fails after a filesystem error. One of them is in exfat_writepages(). Commit b900c61a3f21 ("exfat: drain dirty pages after forced shutdown") in the exfat tree moves that check from exfat_writepages() into exfat_writeback_range().

The merge takes the exfat side of exfat_writepages() but keeps exfat_forced_shutdown() in exfat_writeback_range(). So after an error with errors=remount-ro, writeback keeps writing dirty data to the disk instead of dropping it as the vfs-brauner commit intends.

Use exfat_emergency_state() in exfat_writeback_range(), as next-20261118 did.

---
For folding into the vfs-brauner merge in fs-next. Resent as a new thread with the full context, the first posting was a reply in the 11-18 vfs-brauner/exfat manual merge thread. Applies to next-20261123, built fs/exfat on x86_64 (defconfig plus EXFAT_FS=m, W=1).

 fs/exfat/iomap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/exfat/iomap.c +4 -4
index d0bcf523f48b5..a846fbc450b82 100644
@@ -374,14 +374,14 @@ static ssize_t exfat_writeback_range(struct iomap_writepage_ctx *wpc,
 		struct folio *folio, u64 offset, unsigned int len, u64 end_pos)
 {
 	struct inode *inode = wpc->inode;
+	int error;
 
-	if (exfat_forced_shutdown(inode->i_sb))
-		return -EIO;
+	error = exfat_emergency_state(inode->i_sb);
+	if (error)
+		return error;
 
 	if (offset < wpc->iomap.offset ||
 	    offset >= wpc->iomap.offset + wpc->iomap.length) {
-		int error;
-
 		error = __exfat_iomap_begin(inode, offset, len,
 				0, &wpc->iomap, false,
 				exfat_get_valid_size(EXFAT_I(inode)));

base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5

Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 16 lines · Sasha Levin

Since next-20261119 the merge of the vfs-brauner tree with the exfat tree drops an error check from exfat writeback.

Commit 788f21d1f192 ("exfat: don't set SB_RDONLY after filesystem errors") in the vfs-brauner tree switches the write side shutdown checks to exfat_emergency_state(), which also fails after a filesystem error. One of them is in exfat_writepages(). Commit b900c61a3f21 ("exfat: drain dirty pages after forced shutdown") in the exfat tree moves that check from exfat_writepages() into exfat_writeback_range().

The merge takes the exfat side of exfat_writepages() but keeps exfat_forced_shutdown() in exfat_writeback_range(). So after an error with errors=remount-ro, writeback keeps writing dirty data to the disk instead of dropping it as the vfs-brauner commit intends.

Quoted 6 lines

Use exfat_emergency_state() in exfat_writeback_range(), as next-20261118 did.

Looks good to me:)
Thanks!