linux/fs/overlayfs
Amir Goldstein 235ce9ed96 ovl: check for incompatible features in work dir
An incompatible feature is marked by a non-empty directory nested
2 levels deep under "work" dir, e.g.:
workdir/work/incompat/volatile.

This commit checks for marked incompat features, warns about them
and fails to mount the overlay, for example:
  overlayfs: overlay with incompat feature 'volatile' cannot be mounted

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/...' failed (-39)
  overlayfs: cleanup of 'work/incompat' failed (-39)
  overlayfs: cleanup of 'ovl-work/work' failed (-39)
  overlayfs: failed to create directory /vdf/ovl-work/work (errno: 17);
             mounting read-only

These warnings should give the hint to the user that:
1. mount failure is caused by backward incompatible features
2. mount failure can be resolved by manually removing the "work" directory

There is nothing preventing users on old kernels from manually removing
workdir entirely or mounting overlay with a new workdir, so this is in
no way a full proof backward compatibility enforcement, but only a best
effort.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2020-09-02 10:58:48 +02:00
..
copy_up.c Remove uninitialized_var() macro for v5.9-rc1 2020-08-04 13:49:43 -07:00
dir.c ovl: initialize OVL_UPPERDATA in ovl_lookup() 2020-06-02 22:20:25 +02:00
export.c ovl: relax WARN_ON() when decoding lower directory file handle 2020-07-16 00:09:17 +02:00
file.c ovl: fix unneeded call to ovl_change_flags() 2020-07-16 07:24:47 +02:00
inode.c overlayfs update for 5.8 2020-06-09 15:40:50 -07:00
Kconfig docs: fix broken references to text files 2020-04-20 15:35:59 -06:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
namei.c ovl: fix lookup of indexed hardlinks with metacopy 2020-07-16 07:24:47 +02:00
overlayfs.h ovl: change ovl_copy_up_flags static 2020-07-16 00:06:16 +02:00
ovl_entry.h ovl: get rid of redundant members in struct ovl_fs 2020-06-04 10:48:19 +02:00
readdir.c ovl: check for incompatible features in work dir 2020-09-02 10:58:48 +02:00
super.c ovl: check for incompatible features in work dir 2020-09-02 10:58:48 +02:00
util.c ovl: add accessor for ofs->upper_mnt 2020-06-04 10:48:19 +02:00