From: Nick Piggin <npiggin@kernel.dk>
To: linux-fsdevel@vger.kernel.org
Subject: [patch 1/4] fs: mark_inode_dirty barrier fix
Date: Tue, 23 Nov 2010 00:05:07 +1100 [thread overview]
Message-ID: <20101122130507.GC12716@amd> (raw)
fs: mark_inode_dirty barrier fix
Filesystems appear to be using ->dirty_inode, expecting that the dirtying
operating is done and visible to all CPUs (eg. setting private inode dirty
bits, without any barriers themselves). So release the dirty "critical
section" with a barrier before calling ->dirty_inode.
Cost is not significantly changed, because we're just moving the barrier.
Those filesystems that do use ->dirty_inode should have to care slightly
less about barriers, which is a good thing.
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
---
Here's some data integrity fixes for inode writeback cache. I'd like to
hear comments.
Index: linux-2.6/fs/fs-writeback.c
===================================================================
--- linux-2.6.orig/fs/fs-writeback.c 2010-11-19 16:47:00.000000000 +1100
+++ linux-2.6/fs/fs-writeback.c 2010-11-19 16:49:39.000000000 +1100
@@ -934,6 +934,15 @@ void __mark_inode_dirty(struct inode *in
bool wakeup_bdi = false;
/*
+ * Make sure that changes are seen by all cpus before we test i_state
+ * or mark anything as being dirty. Ie. all dirty state should be
+ * written to the inode and visible. Like an "unlock" operation, the
+ * mark_inode_dirty call must "release" our ordering window that is
+ * opened when we started modifying the inode.
+ */
+ smp_mb();
+
+ /*
* Don't do this for I_DIRTY_PAGES - that doesn't actually
* dirty the inode itself
*/
@@ -942,12 +951,6 @@ void __mark_inode_dirty(struct inode *in
sb->s_op->dirty_inode(inode);
}
- /*
- * make sure that changes are seen by all cpus before we test i_state
- * -- mikulas
- */
- smp_mb();
-
/* avoid the locking if we can */
if ((inode->i_state & flags) == flags)
return;
next reply other threads:[~2010-11-22 13:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-22 13:05 Nick Piggin [this message]
2010-11-22 13:06 ` [patch 2/4] fs: fsync inode dirty race fix Nick Piggin
2010-11-22 13:23 ` Christoph Hellwig
2010-11-22 13:43 ` Nick Piggin
2010-11-22 13:07 ` [patch 3/4] fs: introduce inode dirty state helpers Nick Piggin
2010-11-22 13:25 ` Christoph Hellwig
2010-11-22 13:44 ` Nick Piggin
2010-11-22 13:09 ` [patch 4/4] ext2: inode sync fixes Nick Piggin
2010-11-22 13:16 ` [patch 1/4] fs: mark_inode_dirty barrier fix Christoph Hellwig
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=20101122130507.GC12716@amd \
--to=npiggin@kernel.dk \
--cc=linux-fsdevel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.