NetBSD Problem Report #48211

From gson@gson.org  Sat Sep 14 19:00:27 2013
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id F362971B61
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Sep 2013 19:00:26 +0000 (UTC)
Message-Id: <20130914190022.498BB75E4E@guava.gson.org>
Date: Sat, 14 Sep 2013 22:00:22 +0300 (EEST)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@gnats.NetBSD.org
Subject: Unclean shutdown with active snapshot causes panic during reboot
X-Send-Pr-Version: 3.95

>Number:         48211
>Category:       kern
>Synopsis:       Unclean shutdown with active snapshot causes panic during reboot
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    hannken
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 14 19:05:00 +0000 2013
>Closed-Date:    Mon Sep 16 17:13:58 +0000 2013
>Last-Modified:  Mon Sep 16 17:13:58 +0000 2013
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current, source date 2013.09.07.09.22.37
>Organization:
>Environment:
System: NetBSD i386
Architecture: i386
Machine: i386
>Description:

If NetBSD suffers an unclean shutdown while an fss snapshot is active
on the root file system, the kernel will panic during the reboot
immediately after the root fsck, with a message like "panic:
ffs_snapshot_mount: 472 already on list".

Example console output:

  Starting root file system check:
  /dev/rwd0a: INCORRECT BLOCK COUNT I=472 (2032 should be 2112) (CORRECTED)
  /dev/rwd0a: FREE BLK COUNT(S) WRONG IN SUPERBLK (SALVAGED)
  /dev/rwd0a: SUMMARY INFORMATION BAD (SALVAGED)
  /dev/rwd0a: BLK(S) MISSING IN BIT MAPS (SALVAGED)
  /dev/rwd0a: 16782 files, 380966 used, 326321 free (1033 frags, 40661 blocks, 0.1% fragmentation)
  /dev/rwd0a: MARKING FILE SYSTEM CLEAN
  panic: ffs_snapshot_mount: 472 already on list
  fatal breakpoint trap in supervisor mode
  trap type 1 code 0 eip c027fb24 cs 8 eflags 246 cr2 bbae8d13 ilevel 0 esp c442cb50
  curlwp 0xc1397020 pid 25 lid 1 lowest kstack 0xc442a000
  Stopped in pid 25.1 (mount_ffs) at      netbsd:breakpoint+0x4:  popl    %ebp
  db{0}> t
  breakpoint(c0cb608c,c0ed9840,c0c29e1c,c442cb6c,0,c1373800,c1265e20,c442cb60,c0814ac1,c0c29e1c) at netbsd:breakpoint+0x4
  vpanic(c0c29e1c,c442cb6c,c442cbcc,c0329409,c0c29e1c,1d8,0,b0,2de58000,0) at netbsd:vpanic+0x11c
  printf_nolog(c0c29e1c,1d8,0,b0,2de58000,0,1,490,c122cf00,0) at netbsd:printf_nolog
  ffs_snapshot_mount(c1372000,0,27,c1372000,c135ebb0,6,0,c1373800,c1397020,c12f6208) at netbsd:ffs_snapshot_mount+0x46c
  ffs_mount(c1372000,bfbfea20,c12082e8,c442ccd0,c0e07140,c442ccac,c093a698,c1372000,bfbfea20,c12082e8) at netbsd:ffs_mount+0x6ef
  VFS_MOUNT(c1372000,bfbfea20,c12082e8,c442ccd0,10000,c12082e8,c442cc54,0,c1372000,c442cd28) at netbsd:VFS_MOUNT+0x34
  do_sys_mount(c1397020,0,8048ec8,bfbfea20,10000,bfbfee24,0,4,c442cd28,c442cd3c) at netbsd:do_sys_mount+0x343
  sys___mount50(c1397020,c442cd00,c442cd28,c1355848,0,c442cd00,19a,c442cda0,8048ec8,bfbfea20) at netbsd:sys___mount50+0x4d
  syscall() at netbsd:syscall+0x89
  --- syscall (number 410) ---
  bbacf397:
  db{0}> 

>How-To-Repeat:

This is easy to reproduce.  For example:

  # fssconfig fss0 / /snapshot
  # dd if=/dev/urandom of=/scratch.tmp count=10000
  [enter ddb]
  db{0}> reboot

>Fix:

>Release-Note:

>Audit-Trail:
From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48211 CVS commit: src/sys/ufs/ffs
Date: Mon, 16 Sep 2013 12:36:55 +0000

 Module Name:	src
 Committed By:	hannken
 Date:		Mon Sep 16 12:36:54 UTC 2013

 Modified Files:
 	src/sys/ufs/ffs: ffs_vfsops.c

 Log Message:
 Function ffs_reload() works on a read-only mount, so remove the call
 to ffs_snapshot_mount() as it would panic later with "already on list"
 when remounting read-write.

 Should fix PR kern/48211 (Unclean shutdown with active snapshot causes
 panic during reboot)


 To generate a diff of this commit:
 cvs rdiff -u -r1.287 -r1.288 src/sys/ufs/ffs/ffs_vfsops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: kern-bug-people->hannken
Responsible-Changed-By: hannken@NetBSD.org
Responsible-Changed-When: Mon, 16 Sep 2013 12:41:07 +0000
Responsible-Changed-Why:
Take.


State-Changed-From-To: open->feedback
State-Changed-By: hannken@NetBSD.org
State-Changed-When: Mon, 16 Sep 2013 12:41:07 +0000
State-Changed-Why:
Committed a fix -- please confirm.


State-Changed-From-To: feedback->closed
State-Changed-By: gson@NetBSD.org
State-Changed-When: Mon, 16 Sep 2013 17:13:58 +0000
State-Changed-Why:
Confirmed fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.