summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2020-04-22 09:08:50 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2020-04-30 11:52:07 +0200
commit15fd2ea9f4f3d85fef787ba7db1b87939d0a2754 (patch)
tree2867810f51c8ef99c6447be886e398daa25dc535 /fs/f2fs
parente67f0216939c048f02fe58dc1113738380480061 (diff)
downloadlinux-15fd2ea9f4f3d85fef787ba7db1b87939d0a2754.tar.gz
linux-15fd2ea9f4f3d85fef787ba7db1b87939d0a2754.tar.bz2
linux-15fd2ea9f4f3d85fef787ba7db1b87939d0a2754.zip
ovl: clear ATTR_OPEN from attr->ia_valid
As of now during open(), we don't pass bunch of flags to underlying filesystem. O_TRUNC is one of these. Normally this is not a problem as VFS calls ->setattr() with zero size and underlying filesystem sets file size to 0. But when overlayfs is running on top of virtiofs, it has an optimization where it does not send setattr request to server if dectects that truncation is part of open(O_TRUNC). It assumes that server already zeroed file size as part of open(O_TRUNC). fuse_do_setattr() { if (attr->ia_valid & ATTR_OPEN) { /* * No need to send request to userspace, since actual * truncation has already been done by OPEN. But still * need to truncate page cache. */ } } IOW, fuse expects O_TRUNC to be passed to it as part of open flags. But currently overlayfs does not pass O_TRUNC to underlying filesystem hence fuse/virtiofs breaks. Setup overlayfs on top of virtiofs and following does not zero the file size of a file is either upper only or has already been copied up. fd = open(foo.txt, O_TRUNC | O_WRONLY); There are two ways to fix this. Either pass O_TRUNC to underlying filesystem or clear ATTR_OPEN from attr->ia_valid so that fuse ends up sending a SETATTR request to server. Miklos is concerned that O_TRUNC might have side affects so it is better to clear ATTR_OPEN for now. Hence this patch clears ATTR_OPEN from attr->ia_valid. I found this problem while running unionmount-testsuite. With this patch, unionmount-testsuite passes with overlayfs on top of virtiofs. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Fixes: bccece1ead36 ("ovl: allow remote upper") Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/f2fs')
0 files changed, 0 insertions, 0 deletions