On Fri, Nov 10, 2017 at 4:53 PM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote: > On Tue, Oct 24, 2017 at 01:03:00PM +0300, Amir Goldstein wrote: >> Because overlayfs features were not implemented in the first version >> of overlayfs merged in v3.18, we cannot enforce old kernel not to mount >> overlayfs with new backward incompatible features... but we can try to >> set traps for those who try to perform those mounts. >> >> When enabling a backward incompatible feature, we create a >> non-empty directory nested 2 levels deep under "work" dir, e.g.: >> workdir/work/incompat_features/incomapt_index. >> >> Very old kernels (i.e. v3.18) will fail to remove a non-empty "work" >> dir and fail the mount. Newer kernels will fail to remove a "work" >> dir with entries nested 3 levels and fall back to read-only mount. >> >> User mounting with old kernel will see a warning like these in dmesg: >> overlayfs: cleanup of 'incompat_features/incompat_index' failed (-39) >> overlayfs: cleanup of 'work/incompat_features' failed (-39) >> overlayfs: cleanup of 'ovl-work/work' failed (-39) >> overlayfs: failed to create directory /vdf/ovl-work/work (errno: 17); >> mounting read-only > > This sounds interesting. I am scratching my head and understand what is > backward compatibility in this case. > > So basically somebody booted a new kernel and enabled a new feature. And > now downgraded to old kernel and tried to mount again. And old kernel is > working with metadata of new kernel. To me this if forward compatibility > and not backward compatibility. (Something like ext3 being able to mount > ext4). > > If yes, failing to mount using old kernel for metadata created by > newer kernel (incomatible metadata), sounds reasonable to me. > >> >> These warnings should give the hint to the user that: >> 1. mount failure is caused by backward incompatible features > > Should we call this forward incomatible feature? Older kernels can't work > with metadata of index feature. > To avoid confusion let's just call them incomap/rocompat features without referring to forward/backward, because the terminology is not what matters. When you are confused go to documentation of ext4/xfs and see what that means. Its the exact same concept: - old kernel cannot mount an fs with unknown incomapt features - old kernel can mount only read-only, as fs with unknown rocompat features ext4 also has "compat" features, meaning that old kernel can mount them, but user programs can check if feature exist for whatever reasons. e2fsck will refuse to modify fs even if it has unknown "compat" features. xfs_repair will just warn on unknown "compat" features but will modify fs. I did not see a reason to introduce "compat" features for overlayfs just yet, because there are no userspace tools/lib that can check them. Amir. -- To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html