[RFC v2 0/6] vfs: provide automatic kernel freeze / resume

Luis Chamberlain mcgrof at kernel.org
Sat Apr 17 01:10:20 BST 2021


This picks up where I left off in 2017, I was inclined to respin this
up again due to a new issue Lukas reported which is easy to reproduce.
I posted a stop-gap patch for that issue [0] and a test case, however,
*this* is the work we want upstream to fix these sorts of issues.

As discussed long ago though at LSFMM, we have much work to do. However,
we can take small strides to get us closer. This is trying to take one
step. It addresses most of the comments and feedback from the last
series I posted, however it doesn't address the biggest two issues:

 o provide clean and clear semantics between userspace ioctls /
   automatic fs freeze, and freeze bdev. This also involves moving the
   counter stuff from bdev to the superblock. This is pending work.
 o The loopback hack which breaks the reverse ordering isn't addressed,
   perhaps just flagging it suffices for now?
 o The long term desirable DAG *is* plausable and I have an initial
   kernel graph implementation which I could use, but that may take
   longer to merge.

What this series *does* address based on the last series is:

  o Rebased onto linux-next tag next-20210415
  o Fixed RCU complaints. The issue was that I was adding new fs levels, and
    this increated undesirably also the amount of rw semaphores, but we were
    just using the new levels to distinguish *who* was triggering the suspend,
    it was either inside the kernel and automatic, or triggered by userspace.
  o thaw_super_locked() was added but that unlocks the sb sb->s_umount,
    our exclusive reverse iterate supers however will want to hold that
    semaphore, so we provide a helper which lets the caller do the unlocking
    for you, and make thaw_super_locked() a user of that.
  o WQ_FREEZABLE is now dealt with
  o I have folded the fs freezer removal stuff into the patch which adds
    the automatic fs frezer / thaw work from the kernel as otherwise separting
    this would create intermediate steps which would produce kernels which
    can stall on suspend / resume.

[0] https://lkml.kernel.org/r/20210416235850.23690-1-mcgrof@kernel.org
[1] https://lkml.kernel.org/r/20171129232356.28296-1-mcgrof@kernel.org              

Luis Chamberlain (6):
  fs: provide unlocked helper for freeze_super()
  fs: add frozen sb state helpers
  fs: add a helper for thaw_super_locked() which does not unlock
  fs: distinguish between user initiated freeze and kernel initiated
    freeze
  fs: add iterate_supers_excl() and iterate_supers_reverse_excl()
  fs: add automatic kernel fs freeze / thaw and remove kthread freezing

 fs/btrfs/disk-io.c     |   4 +-
 fs/btrfs/scrub.c       |   2 +-
 fs/cifs/cifsfs.c       |  10 +-
 fs/cifs/dfs_cache.c    |   2 +-
 fs/ext4/ext4_jbd2.c    |   2 +-
 fs/ext4/super.c        |   2 -
 fs/f2fs/gc.c           |   7 +-
 fs/f2fs/segment.c      |   6 +-
 fs/gfs2/glock.c        |   6 +-
 fs/gfs2/main.c         |   4 +-
 fs/jfs/jfs_logmgr.c    |  11 +-
 fs/jfs/jfs_txnmgr.c    |  31 ++--
 fs/nilfs2/segment.c    |  48 +++---
 fs/super.c             | 321 ++++++++++++++++++++++++++++++++++-------
 fs/xfs/xfs_log.c       |   3 +-
 fs/xfs/xfs_mru_cache.c |   2 +-
 fs/xfs/xfs_pwork.c     |   2 +-
 fs/xfs/xfs_super.c     |  14 +-
 fs/xfs/xfs_trans.c     |   3 +-
 fs/xfs/xfs_trans_ail.c |   7 +-
 include/linux/fs.h     |  64 +++++++-
 kernel/power/process.c |  15 +-
 22 files changed, 405 insertions(+), 161 deletions(-)

-- 
2.29.2




More information about the kexec mailing list