From: "Miquel Sabaté Solà" <mssola@mssola.com>
To: dsterba@suse.com
Cc: clm@fb.com, linux-btrfs@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Miquel Sabaté Solà" <mssola@mssola.com>
Subject: [PATCH] btrfs: report filesystem shutdown via fserror
Date: Mon, 16 Feb 2026 01:28:06 +0100 [thread overview]
Message-ID: <20260216002806.3831884-1-mssola@mssola.com> (raw)
Commit 347b7042fb26 ("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>
---
Note that the for-next branch does not include the mentioned commit. I've
built and tested this patch on top of current Linus' tree.
fs/btrfs/fs.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
index 3de3b517810e..92fcebf5766e 100644
--- a/fs/btrfs/fs.h
+++ b/fs/btrfs/fs.h
@@ -33,6 +33,7 @@
#include "async-thread.h"
#include "block-rsv.h"
#include "messages.h"
+#include <linux/fserror.h>
struct inode;
struct super_block;
@@ -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);
+ }
}
/*
--
2.53.0
next reply other threads:[~2026-02-16 0:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 0:28 Miquel Sabaté Solà [this message]
2026-02-18 11:54 ` [PATCH] btrfs: report filesystem shutdown via fserror Filipe Manana
2026-02-18 11:58 ` Miquel Sabaté Solà
[not found] ` <6995a98f.170a0220.4341d.d20aSMTPIN_ADDED_BROKEN@mx.google.com>
2026-02-27 9:29 ` Filipe Manana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260216002806.3831884-1-mssola@mssola.com \
--to=mssola@mssola.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox