Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Sergio Callegari <sergio.callegari@gmail.com>
To: Bart Van Assche <bvanassche@acm.org>, linux-scsi@vger.kernel.org
Subject: Re: Sd card race on resume with filesystem errors (possible data loss?)
Date: Tue, 20 Jan 2026 13:19:18 +0100	[thread overview]
Message-ID: <04811e0b-efc5-47ff-ac16-a97f49280bb7@gmail.com> (raw)
In-Reply-To: <fe070d43-f9b2-45b2-95d8-477154b28dea@acm.org>



On 09/01/2026 21:57, Bart Van Assche wrote:
> 
> Please post the patch on the linux-scsi mailing list if you want it
> included in the upstream kernel.
> 

Hi and thanks.
Before posting the patch, I would like to provide more info about the 
situation. This is what I am experiencing after resume from sleep (as 
seen on the system logs):

These are the lines that follow "PM: suspend exit"

Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 2470304 op 
0x1:(WRITE) flags 0x1800 phys_seg 2 prio class 1
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 1, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 2, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 337600 op 
0x1:(WRITE) flags 0x1800 phys_seg 3 prio class 1
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 3, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 4, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 5, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 346752 op 
0x1:(WRITE) flags 0x1800 phys_seg 3 prio class 1
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 6, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 7, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 8, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 373120 op 
0x1:(WRITE) flags 0x1800 phys_seg 1 prio class 1
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 9, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 378528 op 
0x1:(WRITE) flags 0x1800 phys_seg 3 prio class 1
Jan 19 11:56:43 coccobill kernel: BTRFS error (device dm-0): bdev 
/dev/mapper/luks-7223e129-f73a-4877-98fc-bc00384ce937 errs: wr 10, rd 0, 
flush 0, corrupt 0, gen 0
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 378848 op 
0x1:(WRITE) flags 0x1800 phys_seg 4 prio class 1
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 389600 op 
0x1:(WRITE) flags 0x1800 phys_seg 3 prio class 1
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 390016 op 
0x1:(WRITE) flags 0x1800 phys_seg 6 prio class 1
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 2434752 op 
0x1:(WRITE) flags 0x1800 phys_seg 3 prio class 1
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: I/O error, dev sda, sector 2443904 op 
0x1:(WRITE) flags 0x1800 phys_seg 3 prio class 1
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: sd 2:0:0:0: [sda] tag#0 device offline 
or changed
Jan 19 11:56:43 coccobill kernel: BTRFS: error (device dm-0) in 
btrfs_commit_transaction:2535: errno=-5 IO failure (Error while writing 
out transaction)
Jan 19 11:56:43 coccobill kernel: BTRFS info (device dm-0 state E): 
forced readonly

In this case the errors are serious enough to cause btrfs to get to RO mode.

Let me recall that sda is my sd-card that works with the usb-storage 
module, and that I have layered btrfs over luks encryption on it.

The errors are related to the resume from sleep as they come out *only* 
after "PM: suspend exit". There are no errors for the device in normal 
operation.

Before getting to the patch, I have also made more experiments:

- Trying to modify the usb-storage delay_use parameter has no effect on 
the issue.

This looks strange to me since this parameter should specifically 
control how much time the kernel waits before using the sd-card on my 
system.

Trying to modify the /sys/block/sda/events_poll_msecs also makes no 
difference at all (normally it is -1, I have tried to change that from 
100 ms to 2 s).

Thanks for the attention,

Best
Sergio


  reply	other threads:[~2026-01-20 12:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-02  9:15 Sd card race on resume with filesystem errors (possible data loss?) Sergio Callegari
2026-01-09 20:57 ` Bart Van Assche
2026-01-20 12:19   ` Sergio Callegari [this message]
2026-01-24 20:38     ` Sergio Callegari

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=04811e0b-efc5-47ff-ac16-a97f49280bb7@gmail.com \
    --to=sergio.callegari@gmail.com \
    --cc=bvanassche@acm.org \
    --cc=linux-scsi@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