[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250402-work-freeze-v2-4-6719a97b52ac@kernel.org>
Date: Wed, 2 Apr 2025 16:07:34 +0200
From: Christian Brauner <brauner@...nel.org>
To: linux-fsdevel@...r.kernel.org,
jack@...e.cz
Cc: Christian Brauner <brauner@...nel.org>,
Ard Biesheuvel <ardb@...nel.org>,
linux-efi@...r.kernel.org,
linux-kernel@...r.kernel.org,
James Bottomley <James.Bottomley@...senpartnership.com>,
mcgrof@...nel.org,
hch@...radead.org,
david@...morbit.com,
rafael@...nel.org,
djwong@...nel.org,
pavel@...nel.org,
peterz@...radead.org,
mingo@...hat.com,
will@...nel.org,
boqun.feng@...il.com
Subject: [PATCH v2 4/4] kernfs: add warning about implementing freeze/thaw
Sysfs is built on top of kernfs and sysfs provides the power management
infrastructure to support suspend/hibernate by writing to various files
in /sys/power/. As filesystems may be automatically frozen during
suspend/hibernate implementing freeze/thaw support for kernfs
generically will cause deadlocks as the suspending/hibernation
initiating task will hold a VFS lock that it will then wait upon to be
released. If freeze/thaw for kernfs is needed talk to the VFS.
Signed-off-by: Christian Brauner <brauner@...nel.org>
---
fs/kernfs/mount.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index 1358c21837f1..d2073bb2b633 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -62,6 +62,21 @@ const struct super_operations kernfs_sops = {
.show_options = kernfs_sop_show_options,
.show_path = kernfs_sop_show_path,
+
+ /*
+ * sysfs is built on top of kernfs and sysfs provides the power
+ * management infrastructure to support suspend/hibernate by
+ * writing to various files in /sys/power/. As filesystems may
+ * be automatically frozen during suspend/hibernate implementing
+ * freeze/thaw support for kernfs generically will cause
+ * deadlocks as the suspending/hibernation initiating task will
+ * hold a VFS lock that it will then wait upon to be released.
+ * If freeze/thaw for kernfs is needed talk to the VFS.
+ */
+ .freeze_fs = NULL,
+ .unfreeze_fs = NULL,
+ .freeze_super = NULL,
+ .thaw_super = NULL,
};
static int kernfs_encode_fh(struct inode *inode, __u32 *fh, int *max_len,
--
2.47.2
Powered by blists - more mailing lists