public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Kleikamp <shaggy@austin.ibm.com>
To: blp@cs.stanford.edu
Cc: JFS Discussion <jfs-discussion@lists.sourceforge.net>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	mc@cs.stanford.edu
Subject: Re: [CHECKER] writes not always synchronous on JFS with O_SYNC?
Date: Tue, 22 Mar 2005 13:41:11 -0600	[thread overview]
Message-ID: <1111520471.8082.9.camel@localhost> (raw)
In-Reply-To: <1111498992.8107.5.camel@localhost>

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

On Tue, 2005-03-22 at 07:43 -0600, Dave Kleikamp wrote:
> 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.

The problem is in the journal-replay code and it is triggered by the
reuse of a directory inode by a regular file inode, so reproducing the
bug requires the journal containing both changes to the inode as a
directory and then as a file.

This patch to jfs_fsck fixes the problem.  It wasn't really an issue
with O_SYNC at all, although I believe there are O_SYNC issues that need
to be resolved.  The data itself should be sync'd correctly, as
generic_file_write checks for the O_SYNC flag.  The missing piece in jfs
is that metadata changes to the inode may not always be making it to the
disk when they should.
-- 
David Kleikamp
IBM Linux Technology Center

[-- Attachment #2: fsck-logredo.patch --]
[-- Type: text/x-patch, Size: 1298 bytes --]

Index: jfsutils/libfs/log_work.c
===================================================================
RCS file: /cvsroot/jfs/jfsutils/libfs/log_work.c,v
retrieving revision 1.21
diff -u -p -r1.21 log_work.c
--- jfsutils/libfs/log_work.c	15 Dec 2004 15:53:45 -0000	1.21
+++ jfsutils/libfs/log_work.c	22 Mar 2005 19:23:17 -0000
@@ -1,5 +1,5 @@
 /*
- *   Copyright (c) International Business Machines Corp., 2000-2002
+ *   Copyright (C) International Business Machines Corp., 2000-2005
  *
  *   This program is free software;  you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -2758,6 +2758,11 @@ int updatePage(struct lrd *ld, int32_t l
 						off += 1;
 						data += linesize;
 						seglen -= linesize;
+						/*
+						 * i_data overlaps btroot.
+						 * Strip of 32 bytes
+						 */
+						seglen -= 32;
 					} else if (db->db_idata & mask_8) {
 						/* Only update ibase */
 						db->db_ibase |= mask_8;
@@ -2766,6 +2771,11 @@ int updatePage(struct lrd *ld, int32_t l
 						/* update both */
 						db->db_ibase |= mask_8;
 						db->db_idata |= mask_8;
+						/*
+						 * i_data overlaps btroot.
+						 * Strip of 32 bytes
+						 */
+						seglen -= 32;
 					}
 				}
 			} else if (ino_rem == 1) {	/* inline data */

  reply	other threads:[~2005-03-22 19:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-21 21:10 [CHECKER] writes not always synchronous on JFS with O_SYNC? Ben Pfaff
2005-03-22 13:43 ` Dave Kleikamp
2005-03-22 19:41   ` Dave Kleikamp [this message]
2005-03-22 19:47     ` Ben Pfaff

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=1111520471.8082.9.camel@localhost \
    --to=shaggy@austin.ibm.com \
    --cc=blp@cs.stanford.edu \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mc@cs.stanford.edu \
    /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