Btrfs: add readonly support for error handle
RFC PATCH v3 3/5 Btrfs: add readonly support for error handle
This patch provide a new error handle interface for those errors that handled by current BUG_ONs.
In order to protect btrfs from panic, when it comes to those BUG_ON errors, the interface forces btrfs readonly and saves the FS state to disk. And the filesystem can be umounted, although mabye with some warning in kernel dmesg. Then btrfsck is helpful to recover btrfs.
v1->v2:
move write super stuff from error handle path to unmount in order to avoid deadlock.
Signed-off-by Liu Bo <[email protected]>
--- fs/btrfs/ctree.h | 8 +++++ fs/btrfs/super.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 0 deletions(-)
fs/btrfs/ctree.h +8 -0
@@ -2552,6 +2552,14 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size);/* super.c */ int btrfs_parse_options (struct btrfs_root *root,char *options);int btrfs_sync_fs (struct super_block *sb,int wait); +void __btrfs_std_error (struct btrfs_fs_info *fs_info,const char *function, +unsigned int line,int errno); + +#define btrfs_std_error (fs_info, errno) \ +do { \ + if ((errno)) \ + __btrfs_std_error((fs_info), __func__, __LINE__, (errno));\ +} while (0)/* acl.c */ #ifdef CONFIG_BTRFS_FS_POSIX_ACL
fs/btrfs/super.c +88 -0
94 lines not on this page · raw message
Signature · 1 line
1.7.1