All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: hch@infradead.org, djwong@kernel.org, song@kernel.org,
	rafael@kernel.org, gregkh@linuxfoundation.org,
	viro@zeniv.linux.org.uk, jack@suse.cz, bvanassche@acm.org,
	ebiederm@xmission.com
Cc: mchehab@kernel.org, keescook@chromium.org, p.raghav@samsung.com,
	linux-fsdevel@vger.kernel.org, kernel@tuxforce.de,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: [RFC v3 00/24] vfs: provide automatic kernel freeze / resume
Date: Fri, 13 Jan 2023 16:33:45 -0800	[thread overview]
Message-ID: <20230114003409.1168311-1-mcgrof@kernel.org> (raw)

Darrick J. Wong poked me about the status of the fs freez work, he's
right, it's been too long since the last spin. The last v2 attempt happened
in April 2021 [0], this just takes the feedback from Christoph and spins it
again. I've only done basic build tests on x86_64, and haven't yet run time
tested the stuff, but given the size of this set its better to review early
before getting stuck on details. So this is what I've ended up with so far.

Please help me paint the bike shed, and figure out the stuff perhaps
I had not considered yet. The locking stuff is really the important thing
here.

I'd like to re-iterate that tons of areas of the kernel are using the
kthread freezer stuff for things it probably has no reason to use it, so
once we remove this from the fs, it should be easy to start trimming this
from other parts of the kernel. The kthread freezer stuff was put in place
originally stop IO in flight for fs. Other parts of the kernels should
have no business using this stuff after all this work is done.

[0] https://lore.kernel.org/all/20210417001026.23858-1-mcgrof@kernel.org/

Changes since the last v2:
  * instead of having different semantics for lock / unlocked freeze
    and thaw calls, this unifies the semantics by requiring the lock
    prior to freeze / thaw
  * uses grab_active_super() now in all all places which need to freeze
    or thaw, this includes filesystems, this is to match the locking
    requirements, and so to not add new heuristics over defining if the
    superblock might be in a good state for freeze/thaw.
  * drops SB_FREEZE_COMPLETE_AUTO in favor of just checking for a flag
    to be able to determine if userspace initiated the freeze or if its
    auto (by the kernel pm)
  * folded the pm calls for the VFS so that instead of one call which
    has a one-liner with two routines, we use the same one-liner on the
    pm side of things.
  * split the FS stuff by using a enw temporary flag, so to enable
    easier review of the FS changes
  * more filesystems use the freezer API now so this also converts them
    over
  * adjusted the coccinelle rule to use the new flag and in the end
    removes it

This is all here too:

https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20231010-fs-freeze-v5

Luis Chamberlain (24):
  fs: unify locking semantics for fs freeze / thaw
  fs: add frozen sb state helpers
  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
  xfs: replace kthread freezing with auto fs freezing
  btrfs: replace kthread freezing with auto fs freezing
  ext4: replace kthread freezing with auto fs freezing
  f2fs: replace kthread freezing with auto fs freezing
  cifs: replace kthread freezing with auto fs freezing
  gfs2: replace kthread freezing with auto fs freezing
  jfs: replace kthread freezing with auto fs freezing
  nilfs2: replace kthread freezing with auto fs freezing
  nfs: replace kthread freezing with auto fs freezing
  nfsd: replace kthread freezing with auto fs freezing
  ubifs: replace kthread freezing with auto fs freezing
  ksmbd: replace kthread freezing with auto fs freezing
  jffs2: replace kthread freezing with auto fs freezing
  jbd2: replace kthread freezing with auto fs freezing
  coredump: drop freezer usage
  ecryptfs: replace kthread freezing with auto fs freezing
  fscache: replace kthread freezing with auto fs freezing
  lockd: replace kthread freezing with auto fs freezing
  fs: remove FS_AUTOFREEZE

 block/bdev.c             |   9 +-
 fs/btrfs/disk-io.c       |   4 +-
 fs/btrfs/scrub.c         |   2 +-
 fs/cifs/cifsfs.c         |  10 +-
 fs/cifs/connect.c        |   8 --
 fs/cifs/dfs_cache.c      |   2 +-
 fs/coredump.c            |   2 +-
 fs/ecryptfs/kthread.c    |   1 -
 fs/ext4/ext4_jbd2.c      |   2 +-
 fs/ext4/super.c          |   3 -
 fs/f2fs/gc.c             |  12 +-
 fs/f2fs/segment.c        |   6 +-
 fs/fscache/main.c        |   2 +-
 fs/gfs2/glock.c          |   6 +-
 fs/gfs2/glops.c          |   2 +-
 fs/gfs2/log.c            |   2 -
 fs/gfs2/main.c           |   4 +-
 fs/gfs2/quota.c          |   2 -
 fs/gfs2/super.c          |  11 +-
 fs/gfs2/sys.c            |  12 +-
 fs/gfs2/util.c           |   7 +-
 fs/ioctl.c               |  14 ++-
 fs/jbd2/journal.c        |  54 ++++-----
 fs/jffs2/background.c    |   3 +-
 fs/jfs/jfs_logmgr.c      |  11 +-
 fs/jfs/jfs_txnmgr.c      |  31 ++----
 fs/ksmbd/connection.c    |   3 -
 fs/ksmbd/transport_tcp.c |   2 -
 fs/lockd/clntproc.c      |   1 -
 fs/lockd/svc.c           |   3 -
 fs/nfs/callback.c        |   4 -
 fs/nfsd/nfssvc.c         |   2 -
 fs/nilfs2/segment.c      |  48 ++++----
 fs/quota/quota.c         |   4 +-
 fs/super.c               | 232 ++++++++++++++++++++++++++++++++-------
 fs/ubifs/commit.c        |   4 -
 fs/xfs/xfs_log.c         |   3 +-
 fs/xfs/xfs_log_cil.c     |   2 +-
 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   |   3 -
 include/linux/fs.h       |  53 ++++++++-
 kernel/power/process.c   |  15 ++-
 45 files changed, 393 insertions(+), 229 deletions(-)

-- 
2.35.1


WARNING: multiple messages have this Message-ID (diff)
From: Luis Chamberlain <mcgrof@kernel.org>
To: hch@infradead.org, djwong@kernel.org, song@kernel.org,
	rafael@kernel.org, gregkh@linuxfoundation.org,
	viro@zeniv.linux.org.uk, jack@suse.cz, bvanassche@acm.org,
	ebiederm@xmission.com
Cc: mchehab@kernel.org, keescook@chromium.org, p.raghav@samsung.com,
	linux-fsdevel@vger.kernel.org, kernel@tuxforce.de,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: [RFC v3 00/24] vfs: provide automatic kernel freeze / resume
Date: Fri, 13 Jan 2023 16:33:45 -0800	[thread overview]
Message-ID: <20230114003409.1168311-1-mcgrof@kernel.org> (raw)

Darrick J. Wong poked me about the status of the fs freez work, he's
right, it's been too long since the last spin. The last v2 attempt happened
in April 2021 [0], this just takes the feedback from Christoph and spins it
again. I've only done basic build tests on x86_64, and haven't yet run time
tested the stuff, but given the size of this set its better to review early
before getting stuck on details. So this is what I've ended up with so far.

Please help me paint the bike shed, and figure out the stuff perhaps
I had not considered yet. The locking stuff is really the important thing
here.

I'd like to re-iterate that tons of areas of the kernel are using the
kthread freezer stuff for things it probably has no reason to use it, so
once we remove this from the fs, it should be easy to start trimming this
from other parts of the kernel. The kthread freezer stuff was put in place
originally stop IO in flight for fs. Other parts of the kernels should
have no business using this stuff after all this work is done.

[0] https://lore.kernel.org/all/20210417001026.23858-1-mcgrof@kernel.org/

Changes since the last v2:
  * instead of having different semantics for lock / unlocked freeze
    and thaw calls, this unifies the semantics by requiring the lock
    prior to freeze / thaw
  * uses grab_active_super() now in all all places which need to freeze
    or thaw, this includes filesystems, this is to match the locking
    requirements, and so to not add new heuristics over defining if the
    superblock might be in a good state for freeze/thaw.
  * drops SB_FREEZE_COMPLETE_AUTO in favor of just checking for a flag
    to be able to determine if userspace initiated the freeze or if its
    auto (by the kernel pm)
  * folded the pm calls for the VFS so that instead of one call which
    has a one-liner with two routines, we use the same one-liner on the
    pm side of things.
  * split the FS stuff by using a enw temporary flag, so to enable
    easier review of the FS changes
  * more filesystems use the freezer API now so this also converts them
    over
  * adjusted the coccinelle rule to use the new flag and in the end
    removes it

This is all here too:

https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20231010-fs-freeze-v5

Luis Chamberlain (24):
  fs: unify locking semantics for fs freeze / thaw
  fs: add frozen sb state helpers
  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
  xfs: replace kthread freezing with auto fs freezing
  btrfs: replace kthread freezing with auto fs freezing
  ext4: replace kthread freezing with auto fs freezing
  f2fs: replace kthread freezing with auto fs freezing
  cifs: replace kthread freezing with auto fs freezing
  gfs2: replace kthread freezing with auto fs freezing
  jfs: replace kthread freezing with auto fs freezing
  nilfs2: replace kthread freezing with auto fs freezing
  nfs: replace kthread freezing with auto fs freezing
  nfsd: replace kthread freezing with auto fs freezing
  ubifs: replace kthread freezing with auto fs freezing
  ksmbd: replace kthread freezing with auto fs freezing
  jffs2: replace kthread freezing with auto fs freezing
  jbd2: replace kthread freezing with auto fs freezing
  coredump: drop freezer usage
  ecryptfs: replace kthread freezing with auto fs freezing
  fscache: replace kthread freezing with auto fs freezing
  lockd: replace kthread freezing with auto fs freezing
  fs: remove FS_AUTOFREEZE

 block/bdev.c             |   9 +-
 fs/btrfs/disk-io.c       |   4 +-
 fs/btrfs/scrub.c         |   2 +-
 fs/cifs/cifsfs.c         |  10 +-
 fs/cifs/connect.c        |   8 --
 fs/cifs/dfs_cache.c      |   2 +-
 fs/coredump.c            |   2 +-
 fs/ecryptfs/kthread.c    |   1 -
 fs/ext4/ext4_jbd2.c      |   2 +-
 fs/ext4/super.c          |   3 -
 fs/f2fs/gc.c             |  12 +-
 fs/f2fs/segment.c        |   6 +-
 fs/fscache/main.c        |   2 +-
 fs/gfs2/glock.c          |   6 +-
 fs/gfs2/glops.c          |   2 +-
 fs/gfs2/log.c            |   2 -
 fs/gfs2/main.c           |   4 +-
 fs/gfs2/quota.c          |   2 -
 fs/gfs2/super.c          |  11 +-
 fs/gfs2/sys.c            |  12 +-
 fs/gfs2/util.c           |   7 +-
 fs/ioctl.c               |  14 ++-
 fs/jbd2/journal.c        |  54 ++++-----
 fs/jffs2/background.c    |   3 +-
 fs/jfs/jfs_logmgr.c      |  11 +-
 fs/jfs/jfs_txnmgr.c      |  31 ++----
 fs/ksmbd/connection.c    |   3 -
 fs/ksmbd/transport_tcp.c |   2 -
 fs/lockd/clntproc.c      |   1 -
 fs/lockd/svc.c           |   3 -
 fs/nfs/callback.c        |   4 -
 fs/nfsd/nfssvc.c         |   2 -
 fs/nilfs2/segment.c      |  48 ++++----
 fs/quota/quota.c         |   4 +-
 fs/super.c               | 232 ++++++++++++++++++++++++++++++++-------
 fs/ubifs/commit.c        |   4 -
 fs/xfs/xfs_log.c         |   3 +-
 fs/xfs/xfs_log_cil.c     |   2 +-
 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   |   3 -
 include/linux/fs.h       |  53 ++++++++-
 kernel/power/process.c   |  15 ++-
 45 files changed, 393 insertions(+), 229 deletions(-)

-- 
2.35.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

             reply	other threads:[~2023-01-14  0:34 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-14  0:33 Luis Chamberlain [this message]
2023-01-14  0:33 ` [RFC v3 00/24] vfs: provide automatic kernel freeze / resume Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 01/24] fs: unify locking semantics for fs freeze / thaw Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-16 15:14   ` Jan Kara
2023-01-16 15:14     ` Jan Kara
2023-05-07  3:47     ` Luis Chamberlain
2023-05-07  3:47       ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 02/24] fs: add frozen sb state helpers Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-16 16:11   ` Jan Kara
2023-01-16 16:11     ` Jan Kara
2023-01-14  0:33 ` [RFC v3 03/24] fs: distinguish between user initiated freeze and kernel initiated freeze Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-16 16:10   ` Jan Kara
2023-01-16 16:10     ` Jan Kara
2023-01-18  2:25   ` Darrick J. Wong
2023-01-18  2:25     ` Darrick J. Wong
2023-01-18  9:28     ` Jan Kara
2023-01-18  9:28       ` Jan Kara
2023-05-07  4:08       ` Luis Chamberlain
2023-05-07  4:08         ` Luis Chamberlain
2023-05-23  0:33         ` Darrick J. Wong
2023-05-23  0:33           ` Darrick J. Wong
2023-01-14  0:33 ` [RFC v3 04/24] fs: add iterate_supers_excl() and iterate_supers_reverse_excl() Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 05/24] fs: add automatic kernel fs freeze / thaw and remove kthread freezing Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:57   ` Luis Chamberlain
2023-01-14  0:57     ` Luis Chamberlain
2023-01-16 16:09   ` Jan Kara
2023-01-16 16:09     ` Jan Kara
2023-02-24  3:08   ` Darrick J. Wong
2023-02-24  3:08     ` Darrick J. Wong
2023-05-07  4:07     ` Luis Chamberlain
2023-05-07  4:07       ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 06/24] xfs: replace kthread freezing with auto fs freezing Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 07/24] btrfs: " Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 08/24] ext4: " Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 09/24] f2fs: " Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 10/24] cifs: " Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 11/24] gfs2: " Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 12/24] jfs: " Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 13/24] nilfs2: " Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:33 ` [RFC v3 14/24] nfs: " Luis Chamberlain
2023-01-14  0:33   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 15/24] nfsd: " Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 16/24] ubifs: " Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 17/24] ksmbd: " Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 18/24] jffs2: " Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 19/24] jbd2: " Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 20/24] coredump: drop freezer usage Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 21/24] ecryptfs: replace kthread freezing with auto fs freezing Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 22/24] fscache: " Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 23/24] lockd: " Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain
2023-01-14  0:34 ` [RFC v3 24/24] fs: remove FS_AUTOFREEZE Luis Chamberlain
2023-01-14  0:34   ` Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230114003409.1168311-1-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=djwong@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=keescook@chromium.org \
    --cc=kernel@tuxforce.de \
    --cc=kexec@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=rafael@kernel.org \
    --cc=song@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.