Skip to contentSkip to conversation

sync causing a flush with no data

DISCUSSION Phillip Susi 1 participant 2 messages Feb 2, 2024 – Feb 6, 2024

lore
Share & tools
lore
#0 lore raw

I have noticed that when entering suspend-to-ram, the kernel syncs the filesystem, and ext4 issues a flush even though nothing has been written, causing a disk that has been suspended with runtime pm to wake up for no reason.

It looks like ext4_sync_fs() calls jbd2_trans_will_send_data_barrier(), which returns 0, causing a call to blkdev_issue_flush(). Shouldn't this return a 1 if the transaction is empty?

#1 lore raw
Quoted 3 lines · Phillip Susi

It looks like ext4_sync_fs() calls jbd2_trans_will_send_data_barrier(), which returns 0, causing a call to blkdev_issue_flush(). Shouldn't this return a 1 if the transaction is empty?

Tracing a little more, it appears that jbd2_trans_will_send_data_barrier() is returning 0 because the transaction is already committed. How can this be? If a transaction has been committed, shouldn't a new one be opened? If not, and the transaction indeed has already been committed, then why is that a reason for the fs to issue another barrier? If it has already been committed, then the barrier should already have been issued shouldn't it?