mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 02:01:18 -04:00
btrfs: report filesystem shutdown via fserror
Commit 347b7042fb ("Merge patch series "fs: generic file IO error
reporting"") has introduced a common framework for reporting errors to
fsnotify in a standard way.
One of the functions being introduced is fserror_report_shutdown() that,
when combined with the experimental support for shutdown in btrfs, it
means that user-space can also easily detect whenever a btrfs filesystem
has been marked as shutdown.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
2d2b5507e5
commit
f11c3d8559
@@ -27,6 +27,7 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/xxhash.h>
|
||||
#include <linux/fserror.h>
|
||||
#include <uapi/linux/btrfs.h>
|
||||
#include <uapi/linux/btrfs_tree.h>
|
||||
#include "extent-io-tree.h"
|
||||
@@ -1199,8 +1200,10 @@ static inline void btrfs_force_shutdown(struct btrfs_fs_info *fs_info)
|
||||
* So here we only mark the fs error without flipping it RO.
|
||||
*/
|
||||
WRITE_ONCE(fs_info->fs_error, -EIO);
|
||||
if (!test_and_set_bit(BTRFS_FS_STATE_EMERGENCY_SHUTDOWN, &fs_info->fs_state))
|
||||
if (!test_and_set_bit(BTRFS_FS_STATE_EMERGENCY_SHUTDOWN, &fs_info->fs_state)) {
|
||||
btrfs_crit(fs_info, "emergency shutdown");
|
||||
fserror_report_shutdown(fs_info->sb, GFP_KERNEL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user