Until now, it turns out bcachefs has been lacking freeze/thaw support, which is important for hibernate.
We thought we had freeze/thaw support, but it turns out that when .freeze_fs and .unfreeze_fs were implemented in super_operations, they were never being called - those functions are only called from the blk_holder callbacks, and the engineer implementing them never thought to check that. So - there's a lesson here, and this is why I keep harping on testing. It's not enough to just fire off the automated test suite and call it a day, you do have to put actual thought into checking that your code is behaving as expected :) It turns out the method we were originally talking about for freeze/thaw of just using our existing read-only/read-write paths doesn't work, for reasons that I neglected to remember when hooking up blk_holder_ops (locking and conflicting state management, I assume), so we need to block IOs at a lower level - which conveniently we can do with our existing per-device IO references. This patchset also implements the other blk holder ops - the big one being mark_dead, which now offlines a single device from the filesystem if possible (leaving the filesystem read-write), or if not possible to run in degraded mode, sets the entire filesystem read only. Kent Overstreet (7): fs: export invalidate_inodes() bcachefs: Stash a pointer to the filesystem for blk_holder_ops bcachefs: Make sure c->vfs_sb is set before starting fs bcachefs: Implement blk_holder_ops bcachefs: Fix btree_node_scan io_ref handling bcachefs: bch2_dev_get_ioref() may now sleep bcachefs: Implement freeze/thaw fs/bcachefs/bcachefs.h | 3 + fs/bcachefs/btree_node_scan.c | 17 ++- fs/bcachefs/fs.c | 11 +- fs/bcachefs/journal_io.c | 7 +- fs/bcachefs/sb-members.c | 49 +++++++++ fs/bcachefs/sb-members.h | 18 +--- fs/bcachefs/super-io.c | 5 +- fs/bcachefs/super.c | 191 +++++++++++++++++++++++++++++++++- fs/bcachefs/super.h | 2 + fs/bcachefs/super_types.h | 8 +- fs/inode.c | 1 + fs/internal.h | 1 - include/linux/fs.h | 1 + 13 files changed, 272 insertions(+), 42 deletions(-) -- 2.47.2
