]> git.pld-linux.org Git - packages/kernel.git/blob - panic-in-reiserfs_read_super.patch
- obsolete
[packages/kernel.git] / panic-in-reiserfs_read_super.patch
1     Small patch to fail gracefully in the case of IO error during journal
2     replay
3 diff -rup linux-2.4.7-pre9/fs/reiserfs/super.c linux-2.4.7-pre9.patched/fs/reiserfs/super.c
4 --- linux-2.4.7-pre9/fs/reiserfs/super.c        Wed Jul  4 13:45:55 2001
5 +++ linux-2.4.7-pre9.patched/fs/reiserfs/super.c        Fri Jul 20 15:29:30 2001
6 @@ -779,16 +779,23 @@ struct super_block * reiserfs_read_super
7  
8      if (!(s->s_flags & MS_RDONLY)) {
9         struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s);
10 +       int old_magic;
11 +
12 +       old_magic = strncmp (rs->s_magic,  REISER2FS_SUPER_MAGIC_STRING, 
13 +                            strlen ( REISER2FS_SUPER_MAGIC_STRING));
14 +       if( old_magic && le16_to_cpu(rs->s_version) != 0 ) {
15 +         dput(s->s_root) ;
16 +         s->s_root = NULL ;
17 +         reiserfs_warning("reiserfs: wrong version/magic combination in the super-block\n") ;
18 +         goto error ;
19 +       }
20  
21         journal_begin(&th, s, 1) ;
22         reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
23  
24         rs->s_state = cpu_to_le16 (REISERFS_ERROR_FS);
25  
26 -        if (strncmp (rs->s_magic,  REISER2FS_SUPER_MAGIC_STRING, 
27 -                    strlen ( REISER2FS_SUPER_MAGIC_STRING))) {
28 -           if (le16_to_cpu(rs->s_version) != 0)
29 -               BUG ();
30 +        if ( old_magic ) {
31             // filesystem created under 3.5.x found
32             if (!old_format_only (s)) {
33                 reiserfs_warning("reiserfs: converting 3.5.x filesystem to the new format\n") ;
34 Only in linux-2.4.7-pre9.patched/fs/reiserfs: super.c.orig
This page took 0.042821 seconds and 3 git commands to generate.