From: Lachlan McIlroy <lachlan@sgi.com>
To: xfs@oss.sgi.com
Subject: [PATCH] Ensure sync flushes all dirty data to disk
Date: Fri, 28 Sep 2007 18:04:12 +1000 [thread overview]
Message-ID: <46FCB57C.1040204@sgi.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 527 bytes --]
In xfs_fs_sync_super() treat a sync the same as a filesystem freeze.
This is needed to force the log to disk for inodes which are not marked
dirty in the Linux inode (the inodes are marked dirty on completion of
the log I/O) and so sync_inodes() will not flush them.
In xfs_fs_write_inode() a synchronous flush will not get an EAGAIN
from xfs_inode_flush() and if an asynchronous flush returns EAGAIN
we should pass it on to the caller. If we get an error while flushing
the inode then re-dirty it so we can try again later.
[-- Attachment #2: sync.diff --]
[-- Type: text/x-patch, Size: 994 bytes --]
--- fs/xfs/linux-2.6/xfs_super.c_1.398 2007-09-28 12:37:17.000000000 +1000
+++ fs/xfs/linux-2.6/xfs_super.c 2007-09-28 17:22:24.000000000 +1000
@@ -409,13 +409,8 @@ xfs_fs_write_inode(
flags |= FLUSH_SYNC;
}
error = xfs_inode_flush(XFS_I(inode), flags);
- if (error == EAGAIN) {
- if (sync)
- error = xfs_inode_flush(XFS_I(inode),
- flags | FLUSH_LOG);
- else
- error = 0;
- }
+ if (error)
+ mark_inode_dirty_sync(inode);
return -error;
}
@@ -620,7 +615,7 @@ xfs_fs_sync_super(
int error;
int flags;
- if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) {
+ if (wait || unlikely(sb->s_frozen == SB_FREEZE_WRITE)) {
/*
* First stage of freeze - no more writers will make progress
* now we are here, so we flush delwri and delalloc buffers
@@ -631,7 +626,7 @@ xfs_fs_sync_super(
*/
flags = SYNC_DATA_QUIESCE;
} else
- flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0);
+ flags = SYNC_FSDATA;
error = xfs_sync(mp, flags);
sb->s_dirt = 0;
reply other threads:[~2007-09-28 8:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=46FCB57C.1040204@sgi.com \
--to=lachlan@sgi.com \
--cc=xfs@oss.sgi.com \
/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