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