Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-check-jbd-errors-2.6.5.patch
1 Index: linux-2.6.5-7.201-full/include/linux/ext3_fs.h
2 ===================================================================
3 --- linux-2.6.5-7.201-full.orig/include/linux/ext3_fs.h 2006-08-09 17:59:34.000000000 +0400
4 +++ linux-2.6.5-7.201-full/include/linux/ext3_fs.h      2006-08-22 12:35:55.000000000 +0400
5 @@ -793,6 +793,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.5-7.201-full/fs/ext3/super.c
14 ===================================================================
15 --- linux-2.6.5-7.201-full.orig/fs/ext3/super.c 2006-08-09 17:59:37.000000000 +0400
16 +++ linux-2.6.5-7.201-full/fs/ext3/super.c      2006-08-09 17:59:37.000000000 +0400
17 @@ -39,7 +39,7 @@
18  static int ext3_load_journal(struct super_block *, struct ext3_super_block *);
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 @@ -1781,7 +1781,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.5-7.201-full/fs/ext3/namei.c
36 ===================================================================
37 --- linux-2.6.5-7.201-full.orig/fs/ext3/namei.c 2006-08-09 17:59:37.000000000 +0400
38 +++ linux-2.6.5-7.201-full/fs/ext3/namei.c      2006-08-09 17:59:37.000000000 +0400
39 @@ -1598,7 +1598,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 @@ -1608,7 +1608,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.5-7.201-full/fs/ext3/xattr.c
60 ===================================================================
61 --- linux-2.6.5-7.201-full.orig/fs/ext3/xattr.c 2006-07-14 01:53:23.000000000 +0400
62 +++ linux-2.6.5-7.201-full/fs/ext3/xattr.c      2006-08-09 17:59:37.000000000 +0400
63 @@ -107,7 +107,7 @@ ext3_xattr_register(int name_index, stru
64  {
65         int error = -EINVAL;
66  
67 -       if (name_index > 0 && name_index <= EXT3_XATTR_INDEX_MAX) {
68 +       if (name_index > 0 && name_index < EXT3_XATTR_INDEX_MAX) {
69                 write_lock(&ext3_handler_lock);
70                 if (!ext3_xattr_handlers[name_index-1]) {
71                         ext3_xattr_handlers[name_index-1] = handler;
72 Index: linux-2.6.5-7.201-full/fs/ext3/inode.c
73 ===================================================================
74 --- linux-2.6.5-7.201-full.orig/fs/ext3/inode.c 2006-07-14 01:53:22.000000000 +0400
75 +++ linux-2.6.5-7.201-full/fs/ext3/inode.c      2006-08-22 12:35:28.000000000 +0400
76 @@ -1517,9 +1517,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 @@ -1811,8 +1816,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