Whamcloud - gitweb
- merge with 1_5,some fixes.
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-check-jbd-errors-2.6.9.patch
1 Index: linux-2.6.9-full/fs/ext3/super.c
2 ===================================================================
3 --- linux-2.6.9-full.orig/fs/ext3/super.c       2006-06-02 23:37:51.000000000 +0400
4 +++ linux-2.6.9-full/fs/ext3/super.c    2006-06-02 23:56:29.000000000 +0400
5 @@ -43,7 +43,7 @@ static int ext3_load_journal(struct supe
6                              unsigned long journal_devnum);
7  static int ext3_create_journal(struct super_block *, struct ext3_super_block *,
8                                int);
9 -static void ext3_commit_super (struct super_block * sb,
10 +void ext3_commit_super (struct super_block * sb,
11                                struct ext3_super_block * es,
12                                int sync);
13  static void ext3_mark_recovery_complete(struct super_block * sb,
14 @@ -1991,7 +1991,7 @@ static int ext3_create_journal(struct su
15         return 0;
16  }
17  
18 -static void ext3_commit_super (struct super_block * sb,
19 +void ext3_commit_super (struct super_block * sb,
20                                struct ext3_super_block * es,
21                                int sync)
22  {
23 Index: linux-2.6.9-full/fs/ext3/namei.c
24 ===================================================================
25 --- linux-2.6.9-full.orig/fs/ext3/namei.c       2006-06-02 23:37:49.000000000 +0400
26 +++ linux-2.6.9-full/fs/ext3/namei.c    2006-06-02 23:43:31.000000000 +0400
27 @@ -1599,7 +1599,7 @@ static int ext3_delete_entry (handle_t *
28                               struct buffer_head * bh)
29  {
30         struct ext3_dir_entry_2 * de, * pde;
31 -       int i;
32 +       int i, err;
33  
34         i = 0;
35         pde = NULL;
36 @@ -1609,7 +1609,9 @@ static int ext3_delete_entry (handle_t *
37                         return -EIO;
38                 if (de == de_del)  {
39                         BUFFER_TRACE(bh, "get_write_access");
40 -                       ext3_journal_get_write_access(handle, bh);
41 +                       err = ext3_journal_get_write_access(handle, bh);
42 +                       if (err)
43 +                               return err;
44                         if (pde)
45                                 pde->rec_len =
46                                         cpu_to_le16(le16_to_cpu(pde->rec_len) +
47 Index: linux-2.6.9-full/fs/ext3/xattr.c
48 ===================================================================
49 --- linux-2.6.9-full.orig/fs/ext3/xattr.c       2006-06-01 14:58:48.000000000 +0400
50 +++ linux-2.6.9-full/fs/ext3/xattr.c    2006-06-03 00:02:00.000000000 +0400
51 @@ -132,7 +132,7 @@ ext3_xattr_handler(int name_index)
52  {
53         struct xattr_handler *handler = NULL;
54  
55 -       if (name_index > 0 && name_index <= EXT3_XATTR_INDEX_MAX)
56 +       if (name_index > 0 && name_index < EXT3_XATTR_INDEX_MAX)
57                 handler = ext3_xattr_handler_map[name_index];
58         return handler;
59  }
60 Index: linux-2.6.9-full/fs/ext3/inode.c
61 ===================================================================
62 --- linux-2.6.9-full.orig/fs/ext3/inode.c       2006-06-02 23:37:38.000000000 +0400
63 +++ linux-2.6.9-full/fs/ext3/inode.c    2006-06-03 00:27:41.000000000 +0400
64 @@ -1513,9 +1513,14 @@ out_stop:
65                         if (end > inode->i_size) {
66                                 ei->i_disksize = end;
67                                 i_size_write(inode, end);
68 -                               err = ext3_mark_inode_dirty(handle, inode);
69 -                               if (!ret) 
70 -                                       ret = err;
71 +                               /*
72 +                                * We're going to return a positive `ret'
73 +                                * here due to non-zero-length I/O, so there's
74 +                                * no way of reporting error returns from
75 +                                * ext3_mark_inode_dirty() to userspace.  So
76 +                                * ignore it.
77 +                                */
78 +                               ext3_mark_inode_dirty(handle, inode);
79                         }
80                 }
81                 err = ext3_journal_stop(handle);
82 @@ -1807,8 +1812,18 @@ ext3_clear_blocks(handle_t *handle, stru
83                 ext3_mark_inode_dirty(handle, inode);
84                 ext3_journal_test_restart(handle, inode);
85                 if (bh) {
86 +                       int err;
87                         BUFFER_TRACE(bh, "retaking write access");
88 -                       ext3_journal_get_write_access(handle, bh);
89 +                       err = ext3_journal_get_write_access(handle, bh);
90 +                       if (err) {
91 +                               struct super_block *sb = inode->i_sb;
92 +                               struct ext3_super_block *es = EXT3_SB(sb)->s_es;
93 +                               printk (KERN_CRIT"EXT3-fs: can't continue truncate\n");
94 +                               EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
95 +                               es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
96 +                               ext3_commit_super(sb, es, 1);
97 +                               return;
98 +                       }
99                 }
100         }
101