Skip to content

Instantly share code, notes, and snippets.

@coypoop
Last active May 3, 2016 18:58
Show Gist options
  • Save coypoop/d31d186faf785319207b5d3aed5247c4 to your computer and use it in GitHub Desktop.
Save coypoop/d31d186faf785319207b5d3aed5247c4 to your computer and use it in GitHub Desktop.
From e20bee1c96f0447d638b5929086ec53d3b82077a Mon Sep 17 00:00:00 2001
From: coypu <coypu@sdf.org>
Date: Tue, 3 May 2016 21:54:24 +0300
Subject: [PATCH 1/2] No need to panic on a too big transaction in wapbl_flush
We're already testing it in wapbl_truncate.
Add the detailed message to wapbl_truncate KASSERT.
---
sys/kern/vfs_wapbl.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/sys/kern/vfs_wapbl.c b/sys/kern/vfs_wapbl.c
index 378b0ba..94e6960 100644
--- a/sys/kern/vfs_wapbl.c
+++ b/sys/kern/vfs_wapbl.c
@@ -1209,7 +1209,8 @@ wapbl_truncate(struct wapbl *wl, size_t minfree, int waitonly)
off_t tail;
int error = 0;
- KASSERT(minfree <= (wl->wl_circ_size - wl->wl_reserved_bytes));
+ KASSERTMSG(minfree <= (wl->wl_circ_size - wl->wl_reserved_bytes),
+ "wapbl_truncate: current transaction too big to truncate\n");
KASSERT(rw_write_held(&wl->wl_rwlock));
mutex_enter(&wl->wl_mtx);
@@ -1496,15 +1497,6 @@ wapbl_flush(struct wapbl *wl, int waitfor)
(long)ts.tv_nsec, flushsize);
}
- if (flushsize > (wl->wl_circ_size - wl->wl_reserved_bytes)) {
- /*
- * XXX this could be handled more gracefully, perhaps place
- * only a partial transaction in the log and allow the
- * remaining to flush without the protection of the journal.
- */
- panic("wapbl_flush: current transaction too big to flush\n");
- }
-
error = wapbl_truncate(wl, flushsize, 0);
if (error)
goto out2;
--
2.8.1
From af7d716073bc17ac85b0800da5125f89fca88039 Mon Sep 17 00:00:00 2001
From: coypu <coypu@sdf.org>
Date: Tue, 3 May 2016 21:57:06 +0300
Subject: [PATCH 2/2] Always panic on a too big transaction, not just in
DIAGNOSTIC.
---
sys/kern/vfs_wapbl.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/sys/kern/vfs_wapbl.c b/sys/kern/vfs_wapbl.c
index 94e6960..4ac2420 100644
--- a/sys/kern/vfs_wapbl.c
+++ b/sys/kern/vfs_wapbl.c
@@ -976,17 +976,14 @@ wapbl_end(struct wapbl *wl)
wl->wl_bufbytes, wl->wl_bcount));
#endif
-#ifdef DIAGNOSTIC
size_t flushsize = wapbl_transaction_len(wl);
- if (flushsize > (wl->wl_circ_size - wl->wl_reserved_bytes)) {
- /*
- * XXX this could be handled more gracefully, perhaps place
- * only a partial transaction in the log and allow the
- * remaining to flush without the protection of the journal.
- */
- panic("wapbl_end: current transaction too big to flush\n");
- }
-#endif
+ /*
+ * XXX this could be handled more gracefully, perhaps place
+ * only a partial transaction in the log and allow the
+ * remaining to flush without the protection of the journal.
+ */
+ KASSERTMSG(flushsize <= (wl->wl_circ_size - wl->wl_reserved_bytes),
+ "wapbl_end: current transaction too big to flush\n");
mutex_enter(&wl->wl_mtx);
KASSERT(wl->wl_lock_count > 0);
--
2.8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment