NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/39371



The following reply was made to PR kern/39371; it has been noted by GNATS.

From: "Sergio L. Pascual" <slp%sinrega.org@localhost>
To: "gnats-bugs%netbsd.org@localhost" <gnats-bugs%netbsd.org@localhost>
Cc: 
Subject: Re: kern/39371
Date: Tue, 13 Jan 2015 16:30:52 +0100

 This is a multi-part message in MIME format.
 
 --nextPart2671283.tZjUFLN22J
 Content-Transfer-Encoding: 7Bit
 Content-Type: text/plain; charset="us-ascii"
 
 The situation has somewhat improved these days (tested with -current). Now a 
 root filesystem with a corrupted WAPBL replay is mounted read only, thanks to 
 the MNT_FORCE flag.
 
 The bad news is that kernel will panic when the init scripts try to remount 
 the filesystem read-write and WAPBL enabled:
 
 <--- cut here --->
 boot device: wd0                                                                             
 root on wd0a dumps on wd0b                                                                   
 Unrecognized wapbl magic: 0x5741424c                                                         
 root file system type: ffs                                                                   
 kern.module.path=/stand/amd64/7.99.4/modules                                                 
 clock: unknown CMOS layout                                                                   
 Tue Jan 13 14:57:12 UTC 2015                                                                 
 Starting root file system check:                                                             
 /dev/rwd0a: file system is journaled; not checking                                           
 /: replaying log to disk                                                                     
 uvm_fault(0xfffffe807ed61e68, 0x0, 1) -> e                                                   
 fatal page fault in supervisor mode                                                          
 trap type 6 code 0 rip ffffffff809fd84c cs 8 rflags 10286 cr2 1c ilevel 0 rsp ff             
 fffe8043f7cd18                                                                               
 curlwp 0xfffffe807f121180 pid 62.1 lowest kstack 0xfffffe8043f792c0                          
 kernel: page fault trap, code=0                                                              
 Stopped in pid 62.1 (mount_ffs) at      netbsd:wapbl_replay_write+0x17: movl                 
 1c(%rdi),%ecx
 db{0}>                                                                                      
 <--- cut here --->
 
 This happens because, as ffs_wapbl_replay_start fails, mp->mnt_wapbl_replay  is 
 NULL (there's a KDASSERT there, but I was running a non-DEBUG kernel), which 
 generates an exception when wapbl_replay_write tries to access this structure.
 
 This patch replaces the KDASSERT with a check which, in case of mp-
 >mnt_wapbl_replay being uninitialized, returns EFTYPE, allowing the user to 
 use the emergency shell to run fsck on the root filesystem.
 
 
 --nextPart2671283.tZjUFLN22J
 Content-Disposition: attachment; filename="netbsd_wapbl_rootmount.diff"
 Content-Transfer-Encoding: 7Bit
 Content-Type: text/x-patch; charset="UTF-8"; name="netbsd_wapbl_rootmount.diff"
 
 diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
 index 1d1e32a..adb4970 100644
 --- a/sys/ufs/ffs/ffs_vfsops.c
 +++ b/sys/ufs/ffs/ffs_vfsops.c
 @@ -585,9 +585,13 @@ ffs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
                         fs->fs_fmod = 1;
  #ifdef WAPBL
                         if (fs->fs_flags & FS_DOWAPBL) {
 +                               if (!mp->mnt_wapbl_replay) {
 +                                       printf("%s: WAPBL replay corrupted\n",
 +                                   mp->mnt_stat.f_mntonname);
 +                                   return EFTYPE;
 +                               }
                                 printf("%s: replaying log to disk\n",
                                     mp->mnt_stat.f_mntonname);
 -                               KDASSERT(mp->mnt_wapbl_replay);
                                 error = wapbl_replay_write(mp->mnt_wapbl_replay,
                                                            devvp);
                                 if (error) {
 
 --nextPart2671283.tZjUFLN22J--
 


Home | Main Index | Thread Index | Old Index