generic-find-next-le-bit: Import whitespace changes and akpm sign-off from mm
[ext4-patch-queue.git] / jbd-stats-through-procfs_fix.patch
blob7c5f502509a5523e162bd753b565d8a49272038e
1 From: Mingming Cao <cmm@us.ibm.com>
4 On Tue, 2007-07-10 at 21:42 -0700, Andrew Morton wrote:
5 On Tue, 10 Jul 2007 23:21:49 -0400 "Cédric Augonnet" <cedric.augonnet@gmail.com> wrote:
7 > > 2007/7/10, Andrew Morton <akpm@linux-foundation.org>:
8 > >
9 > > Hi all,
10 > >
11 > > > > + size = sizeof(struct transaction_stats_s);
12 > > > > + s->stats = kmalloc(size, GFP_KERNEL);
13 > > > > + if (s == NULL) {
14 > > > > + kfree(s);
15 > > > > + return -EIO;
16 > > >
17 > > > ENOMEM
18 > >
19 > > I'm sorry if i missed some point, but i just don't see the use of such
20 > > a kfree here, not sure Andrew meant you should only return ENOMEM
21 > > instead, but why issuing those kfree(NULL), instead of just a if (!s)
22 > > return ENOMEM ?
23 > >
25 > You found a bug. It was meant to be
27 > if (s->stats == NULL)
30 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
31 ---
33 fs/jbd2/journal.c | 2 +-
34 include/linux/jbd2.h | 3 +++
35 2 files changed, 4 insertions(+), 1 deletion(-)
38 Index: linux-2.6.23-rc6/fs/jbd2/journal.c
39 ===================================================================
40 --- linux-2.6.23-rc6.orig/fs/jbd2/journal.c 2007-09-20 17:26:01.000000000 -0700
41 +++ linux-2.6.23-rc6/fs/jbd2/journal.c 2007-09-20 17:26:02.000000000 -0700
42 @@ -751,7 +751,7 @@ static int jbd2_seq_history_open(struct
43 return -EIO;
44 size = sizeof(struct transaction_stats_s) * journal->j_history_max;
45 s->stats = kmalloc(size, GFP_KERNEL);
46 - if (s == NULL) {
47 + if (s->stats == NULL) {
48 kfree(s);
49 return -EIO;
51 Index: linux-2.6.23-rc6/include/linux/jbd2.h
52 ===================================================================
53 --- linux-2.6.23-rc6.orig/include/linux/jbd2.h 2007-09-20 17:26:01.000000000 -0700
54 +++ linux-2.6.23-rc6/include/linux/jbd2.h 2007-09-20 17:26:02.000000000 -0700
55 @@ -941,6 +941,9 @@ struct journal_s
56 struct transaction_stats_s *j_history;
57 int j_history_max;
58 int j_history_cur;
59 + /*
60 + * Protect the transactions statistics history
61 + */
62 spinlock_t j_history_lock;
63 struct proc_dir_entry *j_proc_entry;
64 struct transaction_stats_s j_stats;