Re: [CHECKER] writes not always synchronous on JFS with O_SYNC?

From: Dave Kleikamp
Date: Tue Mar 22 2005 - 08:44:40 EST


On Mon, 2005-03-21 at 13:10 -0800, Ben Pfaff wrote:
> Hi. We've been running some tests on JFS and other file systems
> and believe we've found an issue whereby O_SYNC does not always
> cause data to be committed synchronously. On Linux 2.6.11, we
> found that the program appended below causes
> /mnt/sbd0/0006/0010/0029/0033 to contain all zeros, despite the
> use of O_SYNC on the write calls and the fsyncs on the
> directories. It seems to be pretty sensitive to the existence of
> the rmdir calls: if I omit one of them, the data does get
> written.

I can reproduce this behavior, but what I'm seeing is a little more
alarming than the data being written asynchronously. After fsck replays
the journal, the xtree for the file is corrupt, which is why it appears
to contain zeros. The syslog is showing that a corrupted xtree has been
found. I am still investigating.

> Note that /dev/sbd0 is essentially a ramdisk that we've developed
> for testing this kind of thing: it allows a snapshot of a disk's
> momentary contents to be copied out, so that we don't have to do
> a reboot.

I'm getting similar results writing to a regular disk partition and
rebooting.

> Can you confirm this?

Confirmed.

> ret = test_creat("/mnt/sbd0/0006/0028", 511);

test_creat is type void.

> CHECK(ret);
> ret = test_write("/mnt/sbd0/0006/0028", 0);
> CHECK(ret);
> ret = mkdir("/mnt/sbd0/0006/0010/0029", 511);
> CHECK(ret);
> ret = test_creat("/mnt/sbd0/0006/0010/0029/0033", 511);
> CHECK(ret);
> ret = test_write("/mnt/sbd0/0006/0010/0029/0033", 0);
> CHECK(ret);
> ret = test_fsync("/mnt/sbd0/0006/0010/0029");

so is test_fsync

> CHECK(ret);

--
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/