Skip to content

Commit f11c3d8

Browse files
mssolakdave
authored andcommitted
btrfs: report filesystem shutdown via fserror
Commit 347b704 ("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à <[email protected]> Reviewed-by: Filipe Manana <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 2d2b550 commit f11c3d8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/btrfs/fs.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/sched.h>
2828
#include <linux/rbtree.h>
2929
#include <linux/xxhash.h>
30+
#include <linux/fserror.h>
3031
#include <uapi/linux/btrfs.h>
3132
#include <uapi/linux/btrfs_tree.h>
3233
#include "extent-io-tree.h"
@@ -1199,8 +1200,10 @@ static inline void btrfs_force_shutdown(struct btrfs_fs_info *fs_info)
11991200
* So here we only mark the fs error without flipping it RO.
12001201
*/
12011202
WRITE_ONCE(fs_info->fs_error, -EIO);
1202-
if (!test_and_set_bit(BTRFS_FS_STATE_EMERGENCY_SHUTDOWN, &fs_info->fs_state))
1203+
if (!test_and_set_bit(BTRFS_FS_STATE_EMERGENCY_SHUTDOWN, &fs_info->fs_state)) {
12031204
btrfs_crit(fs_info, "emergency shutdown");
1205+
fserror_report_shutdown(fs_info->sb, GFP_KERNEL);
1206+
}
12041207
}
12051208

12061209
/*

0 commit comments

Comments
 (0)