From 9d6e5dc4257a67e7aaec01e6891bba02415f5f99 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Fri, 10 Dec 2010 09:47:05 -0500 Subject: [PATCH] fix jbd2 warnings when using quotas (#578674) --- ...ays-journal-quota-file-modifications.patch | 63 +++++++++++++++++++ kernel.spec | 8 +++ 2 files changed, 71 insertions(+) create mode 100644 ext4-always-journal-quota-file-modifications.patch diff --git a/ext4-always-journal-quota-file-modifications.patch b/ext4-always-journal-quota-file-modifications.patch new file mode 100644 index 000000000..2c73da005 --- /dev/null +++ b/ext4-always-journal-quota-file-modifications.patch @@ -0,0 +1,63 @@ +From be31c919e6ff27f1a08bc3e0725c51935313b002 Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Tue, 27 Jul 2010 11:56:07 -0400 +Subject: ext4: Always journal quota file modifications + +When journaled quota options are not specified, we do writes +to quota files just in data=ordered mode. This actually causes +warnings from JBD2 about dirty journaled buffer because ext4_getblk +unconditionally treats a block allocated by it as metadata. Since +quota actually is filesystem metadata, the easiest way to get rid +of the warning is to always treat quota writes as metadata... + +Signed-off-by: Jan Kara +Signed-off-by: "Theodore Ts'o" +--- + fs/ext4/super.c | 19 +++++-------------- + 1 files changed, 5 insertions(+), 14 deletions(-) + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index a45ced9..f12daa7 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -4030,7 +4030,6 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, + ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); + int err = 0; + int offset = off & (sb->s_blocksize - 1); +- int journal_quota = EXT4_SB(sb)->s_qf_names[type] != NULL; + struct buffer_head *bh; + handle_t *handle = journal_current_handle(); + +@@ -4055,24 +4054,16 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, + bh = ext4_bread(handle, inode, blk, 1, &err); + if (!bh) + goto out; +- if (journal_quota) { +- err = ext4_journal_get_write_access(handle, bh); +- if (err) { +- brelse(bh); +- goto out; +- } ++ err = ext4_journal_get_write_access(handle, bh); ++ if (err) { ++ brelse(bh); ++ goto out; + } + lock_buffer(bh); + memcpy(bh->b_data+offset, data, len); + flush_dcache_page(bh->b_page); + unlock_buffer(bh); +- if (journal_quota) +- err = ext4_handle_dirty_metadata(handle, NULL, bh); +- else { +- /* Always do at least ordered writes for quotas */ +- err = ext4_jbd2_file_inode(handle, inode); +- mark_buffer_dirty(bh); +- } ++ err = ext4_handle_dirty_metadata(handle, NULL, bh); + brelse(bh); + out: + if (err) { +-- +1.7.3.3 + diff --git a/kernel.spec b/kernel.spec index 0596a0a5d..d727c0b97 100644 --- a/kernel.spec +++ b/kernel.spec @@ -812,6 +812,8 @@ Patch13691: mm-vmstat-use-a-single-setter-function-and-callback-for-adjusting-pe Patch13692: orinoco-initialise-priv_hw-before-assigning-the-interrupt.patch +Patch13693: ext4-always-journal-quota-file-modifications.patch + %endif BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root @@ -1265,6 +1267,9 @@ ApplyPatch linux-2.6-32bit-mmap-exec-randomization.patch # ext4 +# rhbz#578674 +ApplyPatch ext4-always-journal-quota-file-modifications.patch + # xfs # btrfs @@ -2116,6 +2121,9 @@ fi # and build. %changelog +* Fri Dec 10 2010 Kyle McMartin +- Fix jbd2 warnings when using quotas. (#578674) + * Thu Dec 09 2010 Kyle McMartin - Snarf patch from wireless-next to fix mdomsch's orinico wifi. (orinoco: initialise priv->hw before assigning the interrupt)