]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/error.h
Update bcachefs sources to 4b5917839c bcachefs: Fix a null ptr deref in check_xattr()
[bcachefs-tools-debian] / libbcachefs / error.h
index b603d738c54927e785e60ee2d14260b096c07f8a..7ce9540052e53df99a90d4ac958c671ad375bdc7 100644 (file)
@@ -73,8 +73,8 @@ do {                                                                  \
 #define bch2_trans_inconsistent(trans, ...)                            \
 ({                                                                     \
        bch_err(trans->c, __VA_ARGS__);                                 \
-       bch2_inconsistent_error(trans->c);                              \
        bch2_dump_trans_updates(trans);                                 \
+       bch2_inconsistent_error(trans->c);                              \
 })
 
 #define bch2_trans_inconsistent_on(cond, trans, ...)                   \
@@ -91,19 +91,14 @@ do {                                                                        \
  * be able to repair:
  */
 
-enum fsck_err_opts {
-       FSCK_OPT_EXIT,
-       FSCK_OPT_YES,
-       FSCK_OPT_NO,
-       FSCK_OPT_ASK,
-};
-
 struct fsck_err_state {
        struct list_head        list;
        const char              *fmt;
        u64                     nr;
        bool                    ratelimited;
-       char                    buf[512];
+       int                     ret;
+       int                     fix;
+       char                    *last_msg;
 };
 
 #define FSCK_CAN_FIX           (1 << 0)
@@ -121,7 +116,6 @@ void bch2_flush_fsck_errs(struct bch_fs *);
                                                                        \
        if (_ret != -BCH_ERR_fsck_fix &&                                \
            _ret != -BCH_ERR_fsck_ignore) {                             \
-               bch_err(c, "Unable to continue, halting");              \
                ret = _ret;                                             \
                goto fsck_err;                                          \
        }                                                               \
@@ -187,36 +181,25 @@ void bch2_io_error_work(struct work_struct *);
 /* Does the error handling without logging a message */
 void bch2_io_error(struct bch_dev *);
 
-/* Logs message and handles the error: */
-#define bch2_dev_io_error(ca, fmt, ...)                                        \
-do {                                                                   \
-       printk_ratelimited(KERN_ERR "bcachefs (%s): " fmt,              \
-               (ca)->name, ##__VA_ARGS__);                             \
-       bch2_io_error(ca);                                              \
-} while (0)
-
-#define bch2_dev_inum_io_error(ca, _inum, _offset, fmt, ...)           \
-do {                                                                   \
-       printk_ratelimited(KERN_ERR "bcachefs (%s inum %llu offset %llu): " fmt,\
-               (ca)->name, (_inum), (_offset), ##__VA_ARGS__);         \
-       bch2_io_error(ca);                                              \
-} while (0)
-
 #define bch2_dev_io_err_on(cond, ca, ...)                              \
 ({                                                                     \
        bool _ret = (cond);                                             \
                                                                        \
-       if (_ret)                                                       \
-               bch2_dev_io_error(ca, __VA_ARGS__);                     \
+       if (_ret) {                                                     \
+               bch_err_dev_ratelimited(ca, __VA_ARGS__);               \
+               bch2_io_error(ca);                                      \
+       }                                                               \
        _ret;                                                           \
 })
 
-#define bch2_dev_inum_io_err_on(cond, ca, _inum, _offset, ...)         \
+#define bch2_dev_inum_io_err_on(cond, ca, ...)                         \
 ({                                                                     \
        bool _ret = (cond);                                             \
                                                                        \
-       if (_ret)                                                       \
-               bch2_dev_inum_io_error(ca, _inum, _offset, __VA_ARGS__);\
+       if (_ret) {                                                     \
+               bch_err_inum_offset_ratelimited(ca, __VA_ARGS__);       \
+               bch2_io_error(ca);                                      \
+       }                                                               \
        _ret;                                                           \
 })