dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Augusto <augusto7743@gmail.com>
To: dm-devel@lists.linux.dev
Subject: BTRFS issues using dm-cache writeback
Date: Tue, 23 Sep 2025 20:33:58 -0300	[thread overview]
Message-ID: <596a2005-32b5-78e8-d069-c2634e360a89@gmail.com> (raw)

Hello.
Thanks for reading my email.
I am an novice Linux user.
I had contacted an dm-cache developer to say about issues using BTRFS 
with writeback cache.
He had replied to me send an message to dm-devel@lists.linux.dev
If here not was the correct area to say it please excuse me.

Writeback cache does damage in file system being an expected behavior, 
but in BTRFS is an serious problem even.
Partial writen in ext4 not does fatal damage, but does it in BTRFS.
Any partial writen in BTRFS does the parent transid error being in some 
times an fatal error not allowing mount or to do any fix.
I when using the OS for an long time without doing an dm writeback flush 
run the command below
sudo btrfs check --readonly --force --mode original --progress /dev/sda5
If is showed the parent transid error will be done in sequence the 
command below to writecache flush
sudo /usr/sbin/dmsetup message /dev/mapper/rc-wb_sda5 0 flush
running again the btrfs check command will show not errors.

I believe is possible an solution to avoid that issue in BTRFS.
If the error happen when is done an partial writen to disk the solution 
maybe for example :
- In dm-writeback cache with 256 MB size was done write of 2 files of 
128 MB so the writeback cache is full.
- Another file is in queue being 64 MB size.
- The writeback need free 64 MB so the first file will be partially sent 
to disk and so does the damage in file system.
- To avoid that issue the dm-cache writecache module will free cache 
memory sent files with complete file size to disk. If need free 64 MB 
wil be sent do disk all files with complete size in that case the file 
of 128 MB.

If that issue is related with BTRFS need an fix for that file system to 
avoid issues when using writeback cache.
I use BTRFS with writeback cache before of 2022 and continue happeing 
that issue.
For me is how if BTRFS developers not has information about that type of 
issue are happening. Thus need to be reported.

dm-cache writeback avoiding any partial writen to disk avoid any 
possibilty of damage in the file system.
I not see any command or option to enable it in dm-cache module.

Please excuse if my explanation not was enough good. I am novice Linux user.
OS Ubuntu 24.04.1 and kernel 6.14
The disk was partitioned for the OS in three partitions being
sda3 = OS
sda4 = /home
sda5 = /opt
the writeback cache are the rc-wb_sda3 , rc-wb_sda4 and rc-wb_sda5
rd0 , rd1 and rd2 are block devices
I have used multiple settings and "combos" in the fstab for BTRFS and 
not is possible avoid issues. I not see that issue being related with 
any settings in fstab.
Please I not want post question or support using btrfs or dm-cache 
module. I only want report the issue with BTRFS and writeback cache and 
so wait an fix or solution to avoid that problem in dm-cache and BTRFS 
future versions.
I wish to you an nice week and good luck in your path in that world. 
Have an blessed week.
Thanks very much for reading that message.

Below are commands used in terminal and outputs.

==== lsblk ====

NAME           MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda              8:0    0 931,5G  0 disk
├─sda1           8:1    0     8M  0 part
├─sda2           8:2    0   586M  0 part /boot
├─sda3           8:3    0  11,4G  0 part
│ └─rc-wb_sda3 252:0    0  11,4G  0 dm   /
├─sda4           8:4    0   977M  0 part
│ └─rc-wb_sda4 252:1    0   977M  0 dm   /home
└─sda5           8:5    0    20G  0 part
   └─rc-wb_sda5 252:2    0    20G  0 dm   /opt
sdb              8:16   0 931,5G  0 disk
├─sdb1           8:17   0     8M  0 part
├─sdb2           8:18   0 585,6M  0 part
├─sdb3           8:19   0  17,2G  0 part
├─sdb4           8:20   0 890,3G  0 part /BTRFS
├─sdb5           8:21   0    12G  0 part
└─sdb6           8:22   0  11,4G  0 part
sr0             11:0    1  1024M  0 rom
zram0          250:0    0     3G  0 disk [SWAP]
rd0            251:0    0   128M  0 disk
└─rc-wb_sda3   252:0    0  11,4G  0 dm   /
rd1            251:1    0   256M  0 disk
└─rc-wb_sda4   252:1    0   977M  0 dm   /home
rd2            251:2    0    16M  0 disk
└─rc-wb_sda5   252:2    0    20G  0 dm   /opt

==== mount ====

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs 
(rw,nosuid,relatime,size=3988400k,nr_inodes=997100,mode=755,inode64)
devpts on /dev/pts type devpts 
(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs 
(rw,nosuid,nodev,noexec,relatime,size=806428k,mode=755,inode64)
/dev/mapper/rc-wb_sda3 on / type btrfs 
(rw,noatime,nodiratime,lazytime,max_inline=0,compress-force=zlib:9,nossd,space_cache=v2,commit=6,subvolid=256,subvol=/@)
securityfs on /sys/kernel/security type securityfs 
(rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs 
(rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 
(rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs 
(rw,relatime,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=3959)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs 
(rw,nosuid,nodev,relatime,pagesize=2M)
tracefs on /sys/kernel/tracing type tracefs 
(rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs 
(rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl 
(rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime,inode64)
tmpfs on /var/crash type tmpfs (rw,nosuid,nodev,relatime,inode64)
tmpfs on /var/log type tmpfs (rw,nosuid,nodev,relatime,inode64)
/dev/mapper/rc-wb_sda4 on /home type btrfs 
(rw,noatime,nodiratime,lazytime,max_inline=0,compress-force=zlib:9,nossd,space_cache=v2,commit=6,subvolid=5,subvol=/)
/dev/mapper/rc-wb_sda5 on /opt type btrfs 
(rw,noatime,nodiratime,lazytime,max_inline=0,compress-force=zlib:9,nossd,space_cache=v2,commit=6,subvolid=5,subvol=/)
/dev/sda2 on /boot type ext2 (rw,relatime)
/dev/sdb4 on /BTRFS type btrfs 
(rw,noatime,nodiratime,lazytime,max_inline=0,compress-force=zlib:9,nossd,nospace_cache,commit=360,subvolid=5,subvol=/)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc 
(rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/user/1000 type tmpfs 
(rw,nosuid,nodev,relatime,size=806424k,nr_inodes=201606,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse 
(rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
portal on /run/user/1000/doc type fuse.portal 
(rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

==== dmsetup table ====

rc-wb_sda3: 0 24000512 writecache s 8:3 251:0 4096 0
rc-wb_sda4: 0 2000896 writecache s 8:4 251:1 4096 0
rc-wb_sda5: 0 42000384 writecache s 8:5 251:2 4096 0

                 reply	other threads:[~2025-09-23 23:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=596a2005-32b5-78e8-d069-c2634e360a89@gmail.com \
    --to=augusto7743@gmail.com \
    --cc=dm-devel@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).