From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Jens Axboe <axboe@kernel•dk>, Theodore Ts'o <tytso@mit•edu>
Cc: linux-next@vger•kernel.org, linux-kernel@vger•kernel.org,
Tejun Heo <tj@kernel•org>, Jan Kara <jack@suse•cz>
Subject: linux-next: manual merge of the block tree with the ext4 tree
Date: Wed, 26 Nov 2014 13:41:52 +1100 [thread overview]
Message-ID: <20141126134152.49cd4296@canb.auug.org.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 1930 bytes --]
Hi Jens,
Today's linux-next merge of the block tree got a conflict in
fs/fs-writeback.c between commit 74ba19abbeae ("vfs: add support for a
lazytime mount option") from the ext4 tree and commit 9c6ac78eb352
("writeback: fix a subtle race condition in I_DIRTY clearing") from the
block tree.
I fixed it up (maybe, please check - see below) and can carry the fix
as necessary (no action is required).
--
Cheers,
Stephen Rothwell sfr@canb•auug.org.au
diff --cc fs/fs-writeback.c
index cab2d6d74828,2d609a5fbfea..000000000000
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@@ -480,12 -479,28 +480,28 @@@ __writeback_single_inode(struct inode *
* write_inode()
*/
spin_lock(&inode->i_lock);
- /* Clear I_DIRTY_PAGES if we've written out all dirty pages */
- if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
- inode->i_state &= ~I_DIRTY_PAGES;
+
dirty = inode->i_state & I_DIRTY;
- inode->i_state &= ~(I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_TIME);
- inode->i_state &= ~I_DIRTY;
++ inode->i_state &= ~(I_DIRTY | I_DIRTY_TIME);
+
+ /*
+ * Paired with smp_mb() in __mark_inode_dirty(). This allows
+ * __mark_inode_dirty() to test i_state without grabbing i_lock -
+ * either they see the I_DIRTY bits cleared or we see the dirtied
+ * inode.
+ *
+ * I_DIRTY_PAGES is always cleared together above even if @mapping
+ * still has dirty pages. The flag is reinstated after smp_mb() if
+ * necessary. This guarantees that either __mark_inode_dirty()
+ * sees clear I_DIRTY_PAGES or we see PAGECACHE_TAG_DIRTY.
+ */
+ smp_mb();
+
+ if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
+ inode->i_state |= I_DIRTY_PAGES;
+
spin_unlock(&inode->i_lock);
+
/* Don't write the inode if only I_DIRTY_PAGES was set */
if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
int err = write_inode(inode, wbc);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next reply other threads:[~2014-11-26 2:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 2:41 Stephen Rothwell [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-06-26 3:09 linux-next: manual merge of the block tree with the ext4 tree Stephen Rothwell
2023-06-26 8:00 ` Christoph Hellwig
2023-06-27 0:46 ` Stephen Rothwell
2023-06-13 2:54 Stephen Rothwell
2023-06-13 5:00 ` Christoph Hellwig
2016-07-15 4:33 Stephen Rothwell
2014-11-27 3:53 Stephen Rothwell
2014-11-27 7:38 ` Christoph Hellwig
2014-11-29 10:08 ` Sabrina Dubroca
2014-11-29 17:38 ` Theodore Ts'o
2014-11-29 22:08 ` Jeremiah Mahler
2010-09-21 4:04 Stephen Rothwell
2010-10-23 2:47 ` Stephen Rothwell
2010-04-29 3:51 Stephen Rothwell
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=20141126134152.49cd4296@canb.auug.org.au \
--to=sfr@canb$(echo .)auug.org.au \
--cc=axboe@kernel$(echo .)dk \
--cc=jack@suse$(echo .)cz \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-next@vger$(echo .)kernel.org \
--cc=tj@kernel$(echo .)org \
--cc=tytso@mit$(echo .)edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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