From nobody@FreeBSD.org  Fri Dec  1 03:14:25 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 24BDB16A403
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  1 Dec 2006 03:14:25 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7218043CA3
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  1 Dec 2006 03:14:13 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id kB13EOWo027674
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 1 Dec 2006 03:14:24 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id kB13EO3J027672;
	Fri, 1 Dec 2006 03:14:24 GMT
	(envelope-from nobody)
Message-Id: <200612010314.kB13EO3J027672@www.freebsd.org>
Date: Fri, 1 Dec 2006 03:14:24 GMT
From: Andrej Binder<andrej.binder@stuba.sk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: left-over fsck_snapshot after unfinished background fsck if filesystem clean
X-Send-Pr-Version: www-3.0

>Number:         106107
>Category:       kern
>Synopsis:       [ufs] left-over fsck_snapshot after unfinished background fsck if filesystem clean
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-fs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 01 03:20:10 GMT 2006
>Closed-Date:    
>Last-Modified:  Sat Apr 03 10:55:35 UTC 2010
>Originator:     Andrej Binder
>Release:        6.1-RELEASE
>Organization:
Slovak Technical University
>Environment:
FreeBSD a.ab.sk 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sat Nov 25 03:00:57 CET 2006     ab@a.ab.sk:/usr/src/sys/amd64/compile/CUSTOM  amd64
>Description:
Whenever fsck is run in background mode, a file called fsck_snapshot gets created in the .snap directory on the checked volume. Fsck then runs its check on this file instead of the live filesystem. Filesystem snapshots (which fsck_snapshot essentially is) are designed to persist over mounts and reboots thus if fsck does not terminate properly for some reason (hard reboot etc), the file gets left over.  This is partially solved on the next background fsck run (commonly just after the system reboots if the fs is marked dirty) since fsck overwrites the left over fsck_snapshot whit a new one and removes it when its done.

The prblem occours when you mark the filesystem clean before the next fsck background run (for example through fsck in singleuser mode). This way the fsck_snapshot file persists and possibly consumes most of the filesystem (depending on the state of the filesystem when the snapshot was made).
>How-To-Repeat:
1) run fsck in background mode
2) halt -qn before fsck finishes (or otherwise terminate it unproperly ... sigkill does not seem to work since fsck is in biord state)
3) boot into singleuser mode
4) fsck to mark the filesystem clean
5) reboot into normal mode and watch the file grow with every change on the live filesystem
>Fix:
Implement a code (maybe into loader after the the fs is mounted) to check for left over fsck snapshots and remove them if appropriate.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: brucec 
Responsible-Changed-When: Sat Apr 3 10:55:14 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=106107 
>Unformatted:
