summaryrefslogtreecommitdiff
path: root/libbcachefs/data_update.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/data_update.c')
-rw-r--r--libbcachefs/data_update.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libbcachefs/data_update.c b/libbcachefs/data_update.c
index 4150feca..b564404d 100644
--- a/libbcachefs/data_update.c
+++ b/libbcachefs/data_update.c
@@ -14,6 +14,7 @@
#include "move.h"
#include "nocow_locking.h"
#include "rebalance.h"
+#include "snapshot.h"
#include "subvolume.h"
#include "trace.h"
@@ -509,6 +510,14 @@ int bch2_data_update_init(struct btree_trans *trans,
unsigned ptrs_locked = 0;
int ret = 0;
+ /*
+ * fs is corrupt we have a key for a snapshot node that doesn't exist,
+ * and we have to check for this because we go rw before repairing the
+ * snapshots table - just skip it, we can move it later.
+ */
+ if (unlikely(k.k->p.snapshot && !bch2_snapshot_equiv(c, k.k->p.snapshot)))
+ return -BCH_ERR_data_update_done;
+
bch2_bkey_buf_init(&m->k);
bch2_bkey_buf_reassemble(&m->k, c, k);
m->btree_id = btree_id;