Bug 216738
Summary: | Adding O_APPEND to O_RDWR with fcntl(fd, F_SETFL) does not work on overlayfs | ||
---|---|---|---|
Product: | File System | Reporter: | Pierre Labastie (pierre.labastie) |
Component: | VFS | Assignee: | fs_vfs |
Status: | NEW --- | ||
Severity: | normal | CC: | pmenzel+bugzilla.kernel.org, regressions, viro |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | broken at commit 164f4064ca8 in torvalds tree (bisect) | Subsystem: | |
Regression: | Yes | Bisected commit-id: | |
Attachments: | C program for reproducing the bug |
I think you should contact the mailing list, if you do not receive any reply here in the next few days. For others, not seeing the commit in the Linux kernel version field right away, it’s commit 164f4064ca8 (keep iocb_flags() result cached in struct file). (In reply to Paul Menzel from comment #1) > I think you should contact the mailing list, if you do not receive any reply > here in the next few days. Normally I'd agree, but when it comes to data corruption I'd say waiting is a bad idea. That's why I created a mail for it now: https://lore.kernel.org/regressions/2505800d-8625-dab0-576a-3a0221954ba3@leemhuis.info/T/#u > For others, not seeing the commit in the Linux kernel version field right > away, it’s commit 164f4064ca8 (keep iocb_flags() result cached in struct > file). thx, I likely would have missed that. Also thx for CCing me, I would have only seen it tomorrow. Pierre, have you tried to revert the commit on top of master? Having the bisection log available here might be good as well if you still have it (just in case, might not be needed in the end). I can confirm the patch proposed by Al Viro fixes the reported problem. Should I write a mail for that? And if so, to which mailing list? Sorry, I'm new to bug reporting to the kernel... Yes, reply to the email with the patch and add a `Tested-by: Pierre …`. Maybe also add Link: https://bugzilla.kernel.org/show_bug.cgi?id=216738 |
Created attachment 303287 [details] C program for reproducing the bug Not sure this is the right place to report this, but at least the offending commit is in this component... Steps to reproduce: $ gcc repro.c $ rm -f toto $ ./a.out $ cat toto; echo On an ext4 fs, the output is (on all versions): abcdefghijklmnopqr Now, make an overlayfs: $ mkdir -p up lo wo mnt $ sudo mount -t overlay overlay -oupperdir=up,lowerdir=lo,workdir=wo mnt $ cd mnt $ rm f toto $ ../a.out $ cat toto; echo before the said commit, the output is: abcdefghijklmnopqr after the said commit, the output is: ghijklmnopqr That is the file is truncated when opened with O_RDWR, with O_APPEND added later, but not when opened with both.