All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Mamedov <rm@romanrm.net>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Btrfs keeps getting corrupted
Date: Mon, 16 Sep 2024 03:31:59 +0500	[thread overview]
Message-ID: <20240916033159.670efe45@nvm> (raw)
In-Reply-To: <05487866-261a-46da-8b1b-fa8e0092be81@gmx.com>

On Mon, 16 Sep 2024 06:59:54 +0930
Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:

> > Such a high disparity in transid mismatch, flush is not working somewhere? But
> > I specifically do "sync" even multiple times now, before unmounting and after.
> 
> Manually sync still relies on FLUSH, and FLUSH is not working on the
> lower storage stack (from LUKS to your SSD/HDD firmware), sync won't
> save you.

I always kept in mind that 'sync' was the key to ensure all data has been
moved from RAM to the HDD. But I now realize that I missed that there's also a
buffer in the HDD, which also needs to be flushed to disk. It could be that I
power-off the device before it manages to do that. Also it is an SMR HDD, so
it might need to do housekeeping with the data on-disk as well.

One idea I got is sending drive to sleep (hdparm -Y) before calling power-off
now. Hopefully that makes it flush before sleep.

> > How can I figure out what is to blame here, is it the enclosure, is it USB,
> > LUKS, Btrfs, or some fundamental bug involving a combination of these?
> 
> In that case, you may want to provide your kernel version first (to rule
> out known bugs or too old kernels), then reduce the depth of the storage
> stack, aka, running btrfs directly on that device as a test.

The kernel is 6.6 series, cannot say exact, but was at most 5-10 point
releases older than latest, both of the times the issue occured.

-- 
With respect,
Roman

  reply	other threads:[~2024-09-15 22:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-15 19:45 Btrfs keeps getting corrupted Roman Mamedov
2024-09-15 21:29 ` Qu Wenruo
2024-09-15 22:31   ` Roman Mamedov [this message]
2024-09-15 23:38     ` Qu Wenruo

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=20240916033159.670efe45@nvm \
    --to=rm@romanrm.net \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.