[PATCH 01/10] fs: add SB_I_OVL_USE_SYNC_FS
From: Josef Bacik
Date: Tue Oct 27 2026 - 17:14:48 EST
sync_filesystem() writes every dirty inode of a filesystem and then calls
->sync_fs(). The data needs that. Whether the metadata does depends on
the filesystem. ext2 copies an inode to its buffer in ->write_inode() and
nowhere else. A filesystem which logs its metadata has recorded the
change when it was made, and ->sync_fs() commits the log.
overlayfs wants to sync what was changed through one overlay instead of
the whole upper filesystem. It knows which inodes it wrote data to. It
has a much harder time with all the inodes which the upper filesystem
dirtied on its behalf, many of which it has no inode of its own for:
whiteouts, index entries, work directories, the parents of all of them.
With a filesystem which logs its metadata it doesn't have to know.
Add SB_I_OVL_USE_SYNC_FS, by which a filesystem says that ->sync_fs() with
wait set makes every change of metadata durable which was made before the
call, whether ->write_inode() was called for the inode or not. Timestamps
which lazytime holds back are not covered by that. As an upper filesystem
of overlayfs it then gets ->sync_fs() instead of sync_filesystem().
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
---
include/linux/fs/super_types.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/fs/super_types.h b/include/linux/fs/super_types.h
index 72f4288e16c5..370b0d27815b 100644
--- a/include/linux/fs/super_types.h
+++ b/include/linux/fs/super_types.h
@@ -359,5 +359,6 @@ struct super_block {
#define SB_I_NOIDMAP 0x00002000 /* No idmapped mounts on this superblock */
#define SB_I_ALLOW_HSM 0x00004000 /* Allow HSM events on this superblock */
#define SB_I_NO_DATA_INTEGRITY 0x00008000 /* fs cannot guarantee data persistence on sync */
+#define SB_I_OVL_USE_SYNC_FS 0x00010000 /* overlayfs: ->sync_fs() commits all metadata */
#endif /* _LINUX_FS_SUPER_TYPES_H */
--
2.55.0