summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-12-04 13:45:33 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-01 11:47:40 -0500
commit267b801fda10b70eca4001a819fcac07f023df6b (patch)
tree41d9bfd3452ecd85ab133d82e753c4e3f4c0a43e /fs/bcachefs/super.c
parent8408fa570ef9b8c35720369bad6b13828ae6b001 (diff)
downloadlinux-267b801fda10b70eca4001a819fcac07f023df6b.tar.gz
linux-267b801fda10b70eca4001a819fcac07f023df6b.tar.bz2
linux-267b801fda10b70eca4001a819fcac07f023df6b.zip
bcachefs: BCH_IOCTL_FSCK_ONLINE
This adds a new ioctl for running fsck on a mounted, in use filesystem. This reuses the fsck_thread code from the previous patch for running fsck on an offline, unmounted filesystem, so that log messages for the fsck thread are redirected to userspace. Only one running fsck instance is allowed at a time; a new semaphore (since the lock will be taken by one thread and released by another) is added for this. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 83e5423fd005..c7c7d4a11eb9 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -762,6 +762,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
refcount_set(&c->ro_ref, 1);
init_waitqueue_head(&c->ro_ref_wait);
+ sema_init(&c->online_fsck_mutex, 1);
init_rwsem(&c->gc_lock);
mutex_init(&c->gc_gens_lock);