Skip to content

RFC Add readonly support to replace BUG_ON phrase

Miao Xie linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4Btrfs: add filesystem state for error handlefs/btrfs/ctree.h+13 -00 replies
2/4Btrfs: add MS_RDONLY to avoid backgroud writebackfs/btrfs/transaction.c+7 -00 replies
3/4Btrfs add readonly support for error handlefs/btrfs/ctree.h fs/btrfs/super.c+96 -02 replies
4/4Btrfs: deal with filesystem state at mount, umount and remountfs/btrfs/disk-io.c fs/btrfs/super.c+32 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/4] Add readonly support to replace BUG_ON phrase

Btrfs has a number of BUG_ON()s, which may lead btrfs to unpleasant panic. Meanwhile, they are very ugly and should be handled more propriately.

There are mainly two ways to deal with these BUG_ON()s.

1. For those errors which can be handled well by callers, we just return their error number to callers.

2. For others, We can force the filesystem readonly when it hits errors, which is what this patchset has done. Replaced BUG_ON() with the interface provided in this patchset, we will get error infomation via dmesg. Since btrfs is now
readonly, we can save our data safely and umount it, then a btrfsck is recommended.

By these ways, we can protect our filesystem from panic caused by those BUG_ONs.

---
 fs/btrfs/ctree.h       |   21 ++++++++++
 fs/btrfs/disk-io.c     |   23 +++++++++++
 fs/btrfs/super.c       |  100 ++++++++++++++++++++++++++++++++++++++++++++++-
 fs/btrfs/transaction.c |    7 +++
 4 files changed, 148 insertions(+), 3 deletions(-)