forked from luck/tmp_suning_uos_patched
8ccf963c62
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:
|
||
---|---|---|
.. | ||
caching | ||
cifs | ||
ext4 | ||
nfs | ||
spufs | ||
9p.rst | ||
adfs.rst | ||
affs.rst | ||
afs.rst | ||
api-summary.rst | ||
autofs-mount-control.rst | ||
autofs.rst | ||
automount-support.rst | ||
befs.rst | ||
bfs.rst | ||
btrfs.rst | ||
ceph.rst | ||
coda.rst | ||
configfs.rst | ||
cramfs.rst | ||
dax.txt | ||
debugfs.rst | ||
devpts.rst | ||
directory-locking.rst | ||
dlmfs.rst | ||
dnotify.rst | ||
ecryptfs.rst | ||
efivarfs.rst | ||
erofs.rst | ||
ext2.rst | ||
ext3.rst | ||
f2fs.rst | ||
fiemap.rst | ||
files.rst | ||
fscrypt.rst | ||
fsverity.rst | ||
fuse-io.rst | ||
fuse.rst | ||
gfs2-glocks.rst | ||
gfs2-uevents.rst | ||
gfs2.rst | ||
hfs.rst | ||
hfsplus.rst | ||
hpfs.rst | ||
index.rst | ||
inotify.rst | ||
isofs.rst | ||
journalling.rst | ||
locking.rst | ||
locks.rst | ||
mandatory-locking.rst | ||
mount_api.rst | ||
nilfs2.rst | ||
ntfs.rst | ||
ocfs2-online-filecheck.rst | ||
ocfs2.rst | ||
omfs.rst | ||
orangefs.rst | ||
overlayfs.rst | ||
path-lookup.rst | ||
path-lookup.txt | ||
porting.rst | ||
proc.rst | ||
qnx6.rst | ||
quota.rst | ||
ramfs-rootfs-initramfs.rst | ||
relay.rst | ||
romfs.rst | ||
seq_file.rst | ||
sharedsubtree.rst | ||
splice.rst | ||
squashfs.rst | ||
sysfs.rst | ||
sysv-fs.rst | ||
tmpfs.rst | ||
ubifs-authentication.rst | ||
ubifs.rst | ||
udf.rst | ||
vfat.rst | ||
vfs.rst | ||
virtiofs.rst | ||
xfs-delayed-logging-design.rst | ||
xfs-self-describing-metadata.rst | ||
zonefs.rst |