* [RFC PATCH 0/4 v2] Btrfs: Add readonly support to replace BUG_ON phrase
@ 2010-12-01 10:18 liubo
0 siblings, 0 replies; only message in thread
From: liubo @ 2010-12-01 10:18 UTC (permalink / raw)
To: Linux Btrfs; +Cc: Josef Bacik, liubo
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.
We still need a incompat flag to make old kernels happy.
v1->v2:
- in order to avoid deadlock thing, move write super stuff from error handle
path to umount time.
- remove BTRFS_SUPER_FLAG_VALID, just use BTRFS_SUPER_FLAG_ERROR to make it
simple.
- add MS_RDONLY check at start of a transaction instead of commit transaction.
---
fs/btrfs/ctree.h | 19 ++++++++++
fs/btrfs/disk-io.c | 47 +++++++++++++++++++++++++-
fs/btrfs/super.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++
fs/btrfs/transaction.c | 3 ++
4 files changed, 156 insertions(+), 1 deletions(-)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-01 10:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-01 10:18 [RFC PATCH 0/4 v2] Btrfs: Add readonly support to replace BUG_ON phrase liubo
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).