kernel_optimize_test/Documentation/filesystems
Sargun Dhillon 8ccf963c62 ovl: implement volatile-specific fsync error behaviour
commit 335d3fc57941e5c6164c69d439aec1cb7a800876 upstream.

Overlayfs's volatile option allows the user to bypass all forced sync calls
to the upperdir filesystem. This comes at the cost of safety. We can never
ensure that the user's data is intact, but we can make a best effort to
expose whether or not the data is likely to be in a bad state.

The best way to handle this in the time being is that if an overlayfs's
upperdir experiences an error after a volatile mount occurs, that error
will be returned on fsync, fdatasync, sync, and syncfs. This is
contradictory to the traditional behaviour of VFS which fails the call
once, and only raises an error if a subsequent fsync error has occurred,
and been raised by the filesystem.

One awkward aspect of the patch is that we have to manually set the
superblock's errseq_t after the sync_fs callback as opposed to just
returning an error from syncfs. This is because the call chain looks
something like this:

sys_syncfs ->
	sync_filesystem ->
		__sync_filesystem ->
			/* The return value is ignored here
			sb->s_op->sync_fs(sb)
			_sync_blockdev
		/* Where the VFS fetches the error to raise to userspace */
		errseq_check_and_advance

Because of this we call errseq_set every time the sync_fs callback occurs.
Due to the nature of this seen / unseen dichotomy, if the upperdir is an
inconsistent state at the initial mount time, overlayfs will refuse to
mount, as overlayfs cannot get a snapshot of the upperdir's errseq that
will increment on error until the user calls syncfs.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
Suggested-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Fixes: c86243b090 ("ovl: provide a mount option "volatile"")
Cc: stable@vger.kernel.org
Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-10 09:29:16 +01:00
..
caching docs: filesystems: Replace HTTP links with HTTPS ones 2020-07-13 09:33:22 -06:00
cifs
ext4 ext4: describe fast_commit feature flags 2020-11-06 23:01:01 -05:00
nfs Documentation: update RPCSEC_GSSv3 RFC link 2020-09-25 18:01:27 -04:00
spufs
9p.rst Replace HTTP links with HTTPS ones: 9P FILE SYSTEM 2020-07-13 11:28:12 -06:00
adfs.rst
affs.rst affs: fix basic permission bits to actually work 2020-08-31 12:20:31 +02:00
afs.rst Replace HTTP links with HTTPS ones: AFS FILESYSTEM 2020-07-13 11:25:29 -06:00
api-summary.rst docs: fs: api-summary.rst: get rid of kernel-doc include 2020-10-28 11:41:15 -06:00
autofs-mount-control.rst Documentation: filesystems: autofs-mount-control: drop doubled words 2020-07-05 14:44:29 -06:00
autofs.rst
automount-support.rst
befs.rst
bfs.rst
btrfs.rst
ceph.rst libceph, rbd, ceph: "blacklist" -> "blocklist" 2020-10-12 15:29:26 +02:00
coda.rst Documentation: coda: annotate duplicated words 2020-07-13 10:02:32 -06:00
configfs.rst Documentation: filesystems: configfs: drop doubled word 2020-07-05 14:44:29 -06:00
cramfs.rst
dax.txt
debugfs.rst debugfs: remove return value of debugfs_create_devm_seqfile() 2020-10-30 08:37:39 +01:00
devpts.rst
directory-locking.rst Documentation: filesystems: directory-locking: drop doubled word 2020-07-05 14:44:29 -06:00
dlmfs.rst ocfs2: replace HTTP links with HTTPS ones 2020-08-07 11:33:22 -07:00
dnotify.rst
ecryptfs.rst
efivarfs.rst
erofs.rst
ext2.rst
ext3.rst
f2fs.rst f2fs: Documentation edits/fixes 2020-09-11 11:11:25 -07:00
fiemap.rst
files.rst
fscrypt.rst docs: fs: fscrypt.rst: get rid of :c:type: tags 2020-10-15 07:49:42 +02:00
fsverity.rst docs: get rid of :c:type explicit declarations for structs 2020-10-15 07:49:40 +02:00
fuse-io.rst
fuse.rst fuse: update project homepage 2020-09-04 11:32:10 +02:00
gfs2-glocks.rst
gfs2-uevents.rst
gfs2.rst
hfs.rst Replace HTTP links with HTTPS ones: Documentation/filesystems 2020-06-26 11:14:12 -06:00
hfsplus.rst
hpfs.rst Replace HTTP links with HTTPS ones: Documentation/filesystems 2020-06-26 11:14:12 -06:00
index.rst Documentation: better locations for sysfs-pci, sysfs-tagging 2020-10-09 09:33:23 -06:00
inotify.rst
isofs.rst
journalling.rst jbd2: drop jbd2_fc_init documentation 2020-11-06 23:01:03 -05:00
locking.rst Documentation/filesystems/locking.rst: remove an incorrect sentence 2020-09-02 07:59:59 -06:00
locks.rst
mandatory-locking.rst
mount_api.rst Documentation: filesystems: mount_api: fix headings 2020-09-24 10:37:43 -06:00
nilfs2.rst
ntfs.rst
ocfs2-online-filecheck.rst
ocfs2.rst ocfs2: replace HTTP links with HTTPS ones 2020-08-07 11:33:22 -07:00
omfs.rst Replace HTTP links with HTTPS ones: OMFS 2020-07-13 11:24:43 -06:00
orangefs.rst
overlayfs.rst ovl: implement volatile-specific fsync error behaviour 2021-02-10 09:29:16 +01:00
path-lookup.rst docs: path-lookup: markup fixes for emphasis 2020-07-27 16:14:13 -06:00
path-lookup.txt
porting.rst
proc.rst doc, mm: clarify /proc/<pid>/oom_score value range 2020-08-12 10:57:56 -07:00
qnx6.rst
quota.rst quota: Fixup http links in quota doc 2020-07-09 08:14:01 +02:00
ramfs-rootfs-initramfs.rst Replace HTTP links with HTTPS ones: Documentation/filesystems 2020-06-26 11:14:12 -06:00
relay.rst
romfs.rst
seq_file.rst doc: seq_file: clarify role of *pos in ->next() 2020-09-28 15:19:44 -06:00
sharedsubtree.rst
splice.rst
squashfs.rst
sysfs.rst Driver Core patches for 5.10-rc1 2020-10-14 16:09:32 -07:00
sysv-fs.rst
tmpfs.rst tmpfs: support 64-bit inums per-sb 2020-08-07 11:33:24 -07:00
ubifs-authentication.rst docs: ubifs-authentication: Add a top-level heading 2020-09-09 11:53:33 -06:00
ubifs.rst
udf.rst udf: Replace HTTP links with HTTPS ones 2020-07-14 14:37:39 +02:00
vfat.rst
vfs.rst docs: filesystems: vfs: correct flag name 2020-07-27 16:19:51 -06:00
virtiofs.rst
xfs-delayed-logging-design.rst
xfs-self-describing-metadata.rst
zonefs.rst zonefs: document the explicit-open mount option 2020-09-15 18:32:58 +09:00