From: Andy Lutomirski <luto@MIT.EDU>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: O_TMPFILE fs corruption (Re: Linux 3.11-rc4)
Date: Sun, 04 Aug 2013 19:34:00 -0700 [thread overview]
Message-ID: <51FF0F18.5020705@mit.edu> (raw)
In-Reply-To: <CA+55aFwTX47vLvZckozZub0rUEo-aCBe7weqe=4mfQGfrW7NUA@mail.gmail.com>
On 08/04/2013 02:09 PM, Linus Torvalds wrote:
> It's that time of the week again..
I still get filesystem corruption with O_TMPFILE. The program below,
run as flinktest foo proc (or flinktest foo linkat if you're root) will
produce a bogus inode. On ext4, once the inode is gone from cache, the
inode will be impossible to delete and will require a fsck to fix
A patch (not necessarily the appropriate fix) is here:
http://article.gmane.org/gmane.linux.kernel/1537088
--- cut here ---
#include <stdio.h>
#include <err.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define __O_TMPFILE 020000000
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#define AT_EMPTY_PATH 0x1000
int main(int argc, char **argv)
{
char buf[128];
if (argc != 3)
errx(1, "Usage: flinktest PATH linkat|proc");
int fd = open(".", O_TMPFILE | O_RDWR, 0600);
if (fd == -1)
err(1, "O_TMPFILE");
write(fd, "test", 4);
if (!strcmp(argv[2], "linkat")) {
if (linkat(fd, "", AT_FDCWD, argv[1], AT_EMPTY_PATH) != 0)
err(1, "linkat");
} else if (!strcmp(argv[2], "proc")) {
sprintf(buf, "/proc/self/fd/%d", fd);
if (linkat(AT_FDCWD, buf, AT_FDCWD, argv[1], AT_SYMLINK_FOLLOW) != 0)
err(1, "linkat");
} else {
errx(1, "invalid mode");
}
return 0;
}
next prev parent reply other threads:[~2013-08-05 2:39 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-04 21:09 Linux 3.11-rc4 Linus Torvalds
2013-08-05 2:34 ` Andy Lutomirski [this message]
2013-08-05 3:45 ` O_TMPFILE fs corruption (Re: Linux 3.11-rc4) Linus Torvalds
2013-08-05 4:45 ` Andrew Lutomirski
2013-08-05 8:26 ` Christoph Hellwig
2013-08-05 16:04 ` Jörn Engel
2013-08-05 14:31 ` Al Viro
2013-08-05 4:20 ` Linux 3.11-rc4 Felipe Contreras
2013-08-05 13:29 ` Oleg Nesterov
2013-08-05 14:27 ` Felipe Contreras
2013-08-05 14:39 ` Oleg Nesterov
2013-08-05 17:02 ` Felipe Contreras
2013-08-05 17:11 ` Oleg Nesterov
2013-08-05 17:40 ` Felipe Contreras
2013-08-05 17:56 ` Oleg Nesterov
2013-08-05 17:39 ` Linus Torvalds
2013-08-05 17:43 ` Felipe Contreras
2013-08-05 18:08 ` Felipe Contreras
2013-08-05 17:47 ` Oleg Nesterov
2013-08-05 18:46 ` Oleg Nesterov
2013-08-05 18:54 ` Linus Torvalds
2013-08-05 18:57 ` Oleg Nesterov
2013-08-05 19:06 ` Linus Torvalds
2013-08-06 15:43 ` [PATCH 0/1] (Was: Linux 3.11-rc4) Oleg Nesterov
2013-08-06 15:43 ` [PATCH 1/1] Revert "ptrace: PTRACE_DETACH should do flush_ptrace_hw_breakpoint(child)" Oleg Nesterov
2013-08-07 12:05 ` [PATCH 0/1] (Was: Linux 3.11-rc4) Grazvydas Ignotas
2013-08-07 17:22 ` Oleg Nesterov
2013-08-07 19:26 ` Linus Torvalds
2013-08-07 19:27 ` Oleg Nesterov
2013-08-07 19:47 ` Linus Torvalds
2013-08-08 15:41 ` Oleg Nesterov
2013-08-08 16:25 ` Linus Torvalds
2013-08-08 16:54 ` Frederic Weisbecker
2013-08-08 18:15 ` Oleg Nesterov
2013-08-09 16:45 ` Frederic Weisbecker
2013-08-09 17:12 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51FF0F18.5020705@mit.edu \
--to=luto@mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox