summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-23 02:30:43 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-01 19:47:36 +0300
commite7f7ddedd67d4abc1ed24dbf33816f2b0a953c02 (patch)
tree838c5385e70184f6a0a1a16dd796dc6cec8fe4fd /fs
parent30418de09e6bda5478a6cfb7c1a54e128b7e2a22 (diff)
downloadlinux-e7f7ddedd67d4abc1ed24dbf33816f2b0a953c02.tar.xz
bcachefs: Add extra verbose logging for ro path
Also log time waiting for c->writes references to be dropped; this will help in debugging why unmounts are taking longer than they should. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/super.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 818ec467a06b..6e38e2d4abf2 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -276,6 +276,8 @@ void bch2_fs_read_only(struct bch_fs *c)
BUG_ON(test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags));
+ bch_verbose(c, "going read-only");
+
/*
* Block new foreground-end write operations from starting - any new
* writes will return -EROFS:
@@ -303,13 +305,21 @@ void bch2_fs_read_only(struct bch_fs *c)
test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags) ||
test_bit(BCH_FS_EMERGENCY_RO, &c->flags));
+ bool writes_disabled = test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags);
+ if (writes_disabled)
+ bch_verbose(c, "finished waiting for writes to stop");
+
__bch2_fs_read_only(c);
wait_event(bch2_read_only_wait,
test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags));
+ if (!writes_disabled)
+ bch_verbose(c, "finished waiting for writes to stop");
+
clear_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags);
clear_bit(BCH_FS_GOING_RO, &c->flags);
+ clear_bit(BCH_FS_RW, &c->flags);
if (!bch2_journal_error(&c->journal) &&
!test_bit(BCH_FS_ERROR, &c->flags) &&
@@ -324,9 +334,9 @@ void bch2_fs_read_only(struct bch_fs *c)
bch_verbose(c, "marking filesystem clean");
bch2_fs_mark_clean(c);
+ } else {
+ bch_verbose(c, "done going read-only, filesystem not clean");
}
-
- clear_bit(BCH_FS_RW, &c->flags);
}
static void bch2_fs_read_only_work(struct work_struct *work)