Skip to content

Commit ef2ed04

Browse files
committed
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. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent eacfbf7 commit ef2ed04

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

fs/kernfs/mount.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,21 @@ const struct super_operations kernfs_sops = {
6262

6363
.show_options = kernfs_sop_show_options,
6464
.show_path = kernfs_sop_show_path,
65+
66+
/*
67+
* sysfs is built on top of kernfs and sysfs provides the power
68+
* management infrastructure to support suspend/hibernate by
69+
* writing to various files in /sys/power/. As filesystems may
70+
* be automatically frozen during suspend/hibernate implementing
71+
* freeze/thaw support for kernfs generically will cause
72+
* deadlocks as the suspending/hibernation initiating task will
73+
* hold a VFS lock that it will then wait upon to be released.
74+
* If freeze/thaw for kernfs is needed talk to the VFS.
75+
*/
76+
.freeze_fs = NULL,
77+
.unfreeze_fs = NULL,
78+
.freeze_super = NULL,
79+
.thaw_super = NULL,
6580
};
6681

6782
static int kernfs_encode_fh(struct inode *inode, __u32 *fh, int *max_len,

0 commit comments

Comments
 (0)