Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+12 -2
+12 -2
fs/bcachefs/super.c
··· 276 276 277 277 BUG_ON(test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags)); 278 278 279 + bch_verbose(c, "going read-only"); 280 + 279 281 /* 280 282 * Block new foreground-end write operations from starting - any new 281 283 * writes will return -EROFS: ··· 305 303 test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags) || 306 304 test_bit(BCH_FS_EMERGENCY_RO, &c->flags)); 307 305 306 + bool writes_disabled = test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags); 307 + if (writes_disabled) 308 + bch_verbose(c, "finished waiting for writes to stop"); 309 + 308 310 __bch2_fs_read_only(c); 309 311 310 312 wait_event(bch2_read_only_wait, 311 313 test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags)); 312 314 315 + if (!writes_disabled) 316 + bch_verbose(c, "finished waiting for writes to stop"); 317 + 313 318 clear_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags); 314 319 clear_bit(BCH_FS_GOING_RO, &c->flags); 320 + clear_bit(BCH_FS_RW, &c->flags); 315 321 316 322 if (!bch2_journal_error(&c->journal) && 317 323 !test_bit(BCH_FS_ERROR, &c->flags) && ··· 334 324 335 325 bch_verbose(c, "marking filesystem clean"); 336 326 bch2_fs_mark_clean(c); 327 + } else { 328 + bch_verbose(c, "done going read-only, filesystem not clean"); 337 329 } 338 - 339 - clear_bit(BCH_FS_RW, &c->flags); 340 330 } 341 331 342 332 static void bch2_fs_read_only_work(struct work_struct *work)