Re: [BUG] cow_file_range failed and kernel panic on zoned device

Johannes Thumshirn <[email protected]> Wed, 22 Jul 2026 13:38:31 +0200
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>
On Tue, Jul 21, 2026 at 05:29:06PM +0200, Johannes Thumshirn wrote:
> On Tue, Jul 21, 2026 at 07:46:53PM +0800, HAN Yuwei wrote:
> > Hi all,
> > I have received a report from a user stating kernel panic when writing to
> > HM-SMR HDD in 1TiB. The user used "mkfs.btrfs -f /dev/sdX" to create a new
> > volume. And he tested xfs on the same device without any issue.
> > 
> > Reported-By: LUO Xiang <[email protected]>
> > HDD Model:Seagate ST18000NM009J
> > uname -a:Linux pro69 7.1.3-arch2-2 #1 SMP PREEMPT_DYNAMIC Thu, 16 Jul 2026
> > 17:41:28 +0000 x86_64 GNU/Linux
> > btrfs-progs: local/btrfs-progs 7.1-1
> > dmesg:
> > [redacted]
> 
> [snip]
> 
> > Jul 19 21:28:37 pro69 kernel: BTRFS: error (device sde state A) in
> > cleanup_transaction:2067: errno=-11 unknown
> > Jul 19 21:28:37 pro69 kernel: BTRFS info (device sde state EA): forced
> > readonly
> > Jul 19 21:29:08 pro69 kernel: BTRFS error (device sde state EA):
> > cow_file_range failed, root=5 inode=268 start=68295892992 len=688128
> > cur_offset=68295892992 cur_alloc_size=0: -30
> > Jul 19 21:29:08 pro69 kernel: writepage_delalloc: 383 callbacks suppressed
> > Jul 19 21:29:08 pro69 kernel: BTRFS error (device sde state EA): failed to
> > run delalloc range, root=5 ino=268 folio=68295892992 submit_bitmap=0
> > start=68295892992 len=688128: -30
> > 
> > the full dmesg can be retreived if interested.
> 
> I /think/ I know the source of the problem. Errno 11 is EAGAIN and from
> writepage_delalloc() it means we've hit a "hole" or out-of-order
> metadata. This is exactly the kind of bug I'm trying to fix for 2 weeks
> now. Not sure why it surfaces now but I see it failing in my fstests
> setups as well.
> 
> There's some hotfix attempts to it and I *hope* I have something
> upstream acceptible as well soon.
> 
> This is a BTRFS specific sequential metadata thing XFS will not see
> because XFS is not putting metadata on sequential zones. 
> 
> I hope I can give you something to try by the end of the week.

Here we go: https://lore.kernel.org/linux-btrfs/[email protected]/T/#me996c86cd69671aee67455dfefccf29062ff222f