Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1545 - genpatches-2.6/trunk/2.6.28
Date: Thu, 16 Apr 2009 11:17:46
Message-Id: E1LuPbD-0007IE-FG@stork.gentoo.org
1 Author: mpagano
2 Date: 2009-04-16 11:17:43 +0000 (Thu, 16 Apr 2009)
3 New Revision: 1545
4
5 Added:
6 genpatches-2.6/trunk/2.6.28/1925_revert-null-dref-in-jbd2-journal-being-ordered-truncate.patch
7 Modified:
8 genpatches-2.6/trunk/2.6.28/0000_README
9 Log:
10 Revert null dereference check in jbd2_journal_being_ordered_truncate for ocfs2
11
12 Modified: genpatches-2.6/trunk/2.6.28/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/2.6.28/0000_README 2009-04-06 14:26:48 UTC (rev 1544)
15 +++ genpatches-2.6/trunk/2.6.28/0000_README 2009-04-16 11:17:43 UTC (rev 1545)
16 @@ -103,6 +103,10 @@
17 From: http://bugs.gentoo.org/show_bug.cgi?id=263870
18 Desc: Fix for performance regression when WRITE_SYNC writes and writes submitted without sync flag caused excession idling in IO scheduler
19
20 +Patch: 1925_revert-null-dref-in-jbd2-journal-being-ordered-truncate.patch
21 +From: http://bugs.gentoo.org/show_bug.cgi?id=263512
22 +Desc: Revert null dereference check in jbd2_journal_being_ordered_truncate for ocfs2
23 +
24 Patch 2300_ppc-legacymem-anon-memory.patch
25 From: https://bugs.gentoo.org/253149
26 Desc: Fix launching of X.org on some PPC platforms
27
28 Added: genpatches-2.6/trunk/2.6.28/1925_revert-null-dref-in-jbd2-journal-being-ordered-truncate.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/2.6.28/1925_revert-null-dref-in-jbd2-journal-being-ordered-truncate.patch (rev 0)
31 +++ genpatches-2.6/trunk/2.6.28/1925_revert-null-dref-in-jbd2-journal-being-ordered-truncate.patch 2009-04-16 11:17:43 UTC (rev 1545)
32 @@ -0,0 +1,103 @@
33 +--- a/fs/ext4/inode.c 2009-04-13 23:54:38.000000000 +0000
34 ++++ b/fs/ext4/inode.c 2009-04-13 23:54:30.000000000 +0000
35 +@@ -46,10 +46,8 @@
36 + static inline int ext4_begin_ordered_truncate(struct inode *inode,
37 + loff_t new_size)
38 + {
39 +- return jbd2_journal_begin_ordered_truncate(
40 +- EXT4_SB(inode->i_sb)->s_journal,
41 +- &EXT4_I(inode)->jinode,
42 +- new_size);
43 ++ return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode,
44 ++ new_size);
45 + }
46 +
47 + static void ext4_invalidatepage(struct page *page, unsigned long offset);
48 +--- a/fs/jbd2/transaction.c 2009-04-13 23:56:00.000000000 +0000
49 ++++ b/fs/jbd2/transaction.c 2009-04-13 23:55:49.000000000 +0000
50 +@@ -2050,46 +2050,26 @@ done:
51 + }
52 +
53 + /*
54 +- * File truncate and transaction commit interact with each other in a
55 +- * non-trivial way. If a transaction writing data block A is
56 +- * committing, we cannot discard the data by truncate until we have
57 +- * written them. Otherwise if we crashed after the transaction with
58 +- * write has committed but before the transaction with truncate has
59 +- * committed, we could see stale data in block A. This function is a
60 +- * helper to solve this problem. It starts writeout of the truncated
61 +- * part in case it is in the committing transaction.
62 +- *
63 +- * Filesystem code must call this function when inode is journaled in
64 +- * ordered mode before truncation happens and after the inode has been
65 +- * placed on orphan list with the new inode size. The second condition
66 +- * avoids the race that someone writes new data and we start
67 +- * committing the transaction after this function has been called but
68 +- * before a transaction for truncate is started (and furthermore it
69 +- * allows us to optimize the case where the addition to orphan list
70 +- * happens in the same transaction as write --- we don't have to write
71 +- * any data in such case).
72 ++ * This function must be called when inode is journaled in ordered mode
73 ++ * before truncation happens. It starts writeout of truncated part in
74 ++ * case it is in the committing transaction so that we stand to ordered
75 ++ * mode consistency guarantees.
76 + */
77 +-int jbd2_journal_begin_ordered_truncate(journal_t *journal,
78 +- struct jbd2_inode *jinode,
79 ++int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode,
80 + loff_t new_size)
81 + {
82 +- transaction_t *inode_trans, *commit_trans;
83 ++ journal_t *journal;
84 ++ transaction_t *commit_trans;
85 + int ret = 0;
86 +
87 +- /* This is a quick check to avoid locking if not necessary */
88 +- if (!jinode->i_transaction)
89 ++ if (!inode->i_transaction && !inode->i_next_transaction)
90 + goto out;
91 +- /* Locks are here just to force reading of recent values, it is
92 +- * enough that the transaction was not committing before we started
93 +- * a transaction adding the inode to orphan list */
94 ++ journal = inode->i_transaction->t_journal;
95 + spin_lock(&journal->j_state_lock);
96 + commit_trans = journal->j_committing_transaction;
97 + spin_unlock(&journal->j_state_lock);
98 +- spin_lock(&journal->j_list_lock);
99 +- inode_trans = jinode->i_transaction;
100 +- spin_unlock(&journal->j_list_lock);
101 +- if (inode_trans == commit_trans) {
102 +- ret = filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping,
103 ++ if (inode->i_transaction == commit_trans) {
104 ++ ret = filemap_fdatawrite_range(inode->i_vfs_inode->i_mapping,
105 + new_size, LLONG_MAX);
106 + if (ret)
107 + jbd2_journal_abort(journal, ret);
108 +--- a/fs/ocfs2/journal.h 2009-04-13 23:56:53.000000000 +0000
109 ++++ b/fs/ocfs2/journal.h 2009-04-13 23:56:44.000000000 +0000
110 +@@ -445,10 +445,8 @@ static inline int ocfs2_jbd2_file_inode(
111 + static inline int ocfs2_begin_ordered_truncate(struct inode *inode,
112 + loff_t new_size)
113 + {
114 +- return jbd2_journal_begin_ordered_truncate(
115 +- OCFS2_SB(inode->i_sb)->journal->j_journal,
116 +- &OCFS2_I(inode)->ip_jinode,
117 +- new_size);
118 ++ return jbd2_journal_begin_ordered_truncate(&OCFS2_I(inode)->ip_jinode,
119 ++ new_size);
120 + }
121 +
122 + #endif /* OCFS2_JOURNAL_H */
123 +--- a/include/linux/jbd2.h 2009-04-13 23:57:40.000000000 +0000
124 ++++ b/include/linux/jbd2.h 2009-04-13 23:57:33.000000000 +0000
125 +@@ -1087,8 +1087,7 @@ extern int jbd2_journal_clear_err (j
126 + extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
127 + extern int jbd2_journal_force_commit(journal_t *);
128 + extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
129 +-extern int jbd2_journal_begin_ordered_truncate(journal_t *journal,
130 +- struct jbd2_inode *inode, loff_t new_size);
131 ++extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
132 + extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
133 + extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
134 +
135 +