From ceri@submonkey.net  Sat Mar 18 11:03:51 2006
Return-Path: <ceri@submonkey.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 80D0D16A400
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Mar 2006 11:03:51 +0000 (UTC)
	(envelope-from ceri@submonkey.net)
Received: from shrike.submonkey.net (cpc2-cdif2-0-0-cust107.cdif.cable.ntl.com [81.104.168.108])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 11DCB43D45
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Mar 2006 11:03:50 +0000 (GMT)
	(envelope-from ceri@submonkey.net)
Received: from ceri by shrike.submonkey.net with local (Exim 4.60 (FreeBSD))
	(envelope-from <ceri@submonkey.net>)
	id 1FKZDq-000N7Y-5c
	for FreeBSD-gnats-submit@freebsd.org; Sat, 18 Mar 2006 11:03:50 +0000
Message-Id: <E1FKZDq-000N7Y-5c@shrike.submonkey.net>
Date: Sat, 18 Mar 2006 11:03:50 +0000
From: Ceri Davies <ceri@submonkey.net>
Sender: Ceri Davies <ceri@submonkey.net>
Reply-To: Ceri Davies <ceri@submonkey.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: snapinfo/libufs only works for disk-backed filesystems
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         94635
>Category:       bin
>Synopsis:       snapinfo(8)/libufs only works for disk-backed filesystems
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-fs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 18 11:10:10 GMT 2006
>Closed-Date:    Sat Feb 19 13:37:33 UTC 2011
>Last-Modified:  Sat Feb 19 13:37:33 UTC 2011
>Originator:     Ceri Davies
>Release:        FreeBSD 6.1-PRERELEASE i386
>Organization:
Submonkey
>Environment:
System: FreeBSD shrike.private.submonkey.net 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #30: Fri Mar 17 16:58:24 GMT 2006 root@shrike.private.submonkey.net:/usr/obj/usr/src/sys/SHRIKE i386

>Description:

My mounted filesystems are currently:

Filesystem           1K-blocks     Used    Avail Capacity  Mounted on
/dev/ad0s1a             507630   110934   356086    24%    /
devfs                        1        1        0   100%    /dev
/dev/md0                253678      558   232826     0%    /tmp
/dev/ad0s1f            8122126  2467276  5005080    33%    /usr
/dev/mirror/userhome  25385514  9353432 14001242    40%    /usr/home
/dev/ad0s1e            4058062   418004  3437156    11%    /usr/local/pgsql
/dev/ad1s1a            1190120   873600   257016    77%    /usr/ports
/dev/ad1s1f           16582478  4024530 11728826    26%    /var
/dev/ad0s1g            4058062        4  3733414     0%    /spare
/dev/stripe/werehaus  65053706 29061010 32740012    47%    /a
devfs                        1        1        0   100%    /var/named/dev
/dev/md1              25385514  8562932 14791742    37%    /snap/20060318-005900/home
/dev/md2              65053706 25343222 36457800    41%    /snap/20060318-005900/a
/dev/md3                507630    52306   414714    11%    /snap/20060318-005900/slash
/dev/md4                253678      104   233280     0%    /snap/20060318-005900/tmp

The recently added snapinfo(8) returns:

# snapinfo -a
ufs_disk_fillout: No such file or directory
ufs_disk_fillout: Unknown error: 0
ufs_disk_fillout: Unknown error: 0
ufs_disk_fillout: Unknown error: 0
ufs_disk_fillout: Unknown error: 0
/.snap/20060314-005900
/.snap/20060315-005901
/.snap/20060316-005900
/.snap/20060317-005900
/.snap/20060318-005900
/usr/home/.snap/20060314-005900
/usr/home/.snap/20060315-005901
/usr/home/.snap/20060316-005900
/usr/home/.snap/20060317-005900
/usr/home/.snap/20060318-005900
/a/.snap/20060314-005900
/a/.snap/20060315-005901
/a/.snap/20060316-005900
/a/.snap/20060317-005900
/a/.snap/20060318-005900

The first three entries are from /dev/md0 through /dev/md4 in that
order, although I'm not sure why the first error is "No such file or
directory", since /dev/md0 does exist.  Verbose examples for both
failure modes:

# snapinfo -v /tmp
ufs_disk_fillout: No such file or directory
(null) mounted on 
        no snapshots found
# snapinfo -v /snap/20060318-005900/a
ufs_disk_fillout: Unknown error: 0
/snap/20060318-005900/a mounted on 
        no snapshots found


>How-To-Repeat:

Mount an md backed filesystem, and run snapinfo against it.

>Fix:

Fix libufs to return something useable in the non-disk case?

>Release-Note:
>Audit-Trail:

From: Ceri Davies <ceri@submonkey.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:  
Subject: Re: bin/94635: snapinfo/libufs only works for disk-backed filesystems
Date: Sun, 19 Mar 2006 19:49:08 +0000

 This gets worse.  Although "snapinfo /tmp" doesn't find any snapshots on
 /tmp (although there are some):
 
 	# snapinfo -v /tmp
 	ufs_disk_fillout: No such file or directory
 	(null) mounted on 
 		no snapshots found
 
 snapinfo -a finds files that are *not* snapshots, indicating that some
 counter is being incremented incorrectly - note the /tmp/sess* entries -
 they're not snapshots, they just have the same inode number on /tmp as
 some snapshots on /)::
 
 # snapinfo -av
 ufs_disk_fillout: No such file or directory
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 ufs_disk_fillout: Unknown error: 0
 /dev/ad0s1a mounted on /
 	snapshot /.snap/20060314-005900 (inode 23)
 	snapshot /.snap/20060315-005901 (inode 74)
 	snapshot /.snap/20060316-005900 (inode 86)
 	snapshot /.snap/20060317-005900 (inode 14)
 	snapshot /.snap/20060318-005900 (inode 21)
 	snapshot /.snap/20060319-005900 (inode 73)
 	snapshot /.snap/20060319-172149 (inode 102)
 /dev/ad0s1a mounted on /
 	snapshot /tmp/sess_ffad24fb1391f4dba12ccc8bcbc09095 (inode 23)
 	snapshot /tmp/sess_946be72ae10b39fc412ca4f4969aa9cd (inode 14)
 	snapshot /tmp/sess_200df409893ec1b4fdd68c77e5cc2517 (inode 21)
 /dev/ad0s1f mounted on /usr
 	snapshot /usr/.snap/20060319-171958 (inode 2242)
 	snapshot /usr/.snap/20060319-180812 (inode 2243)
 /dev/mirror/userhome mounted on /usr/home
 	snapshot /usr/home/.snap/20060314-005900 (inode 12)
 	snapshot /usr/home/.snap/20060315-005901 (inode 13)
 	snapshot /usr/home/.snap/20060316-005900 (inode 15)
 	snapshot /usr/home/.snap/20060317-005900 (inode 4)
 	snapshot /usr/home/.snap/20060318-005900 (inode 6)
 	snapshot /usr/home/.snap/20060319-005900 (inode 10)
 	snapshot /usr/home/.snap/20060319-172007 (inode 16)
 	snapshot /usr/home/.snap/20060319-172149 (inode 17)
 /dev/ad0s1e mounted on /usr/local/pgsql
 	no snapshots found
 /dev/ad1s1a mounted on /usr/ports
 	no snapshots found
 /dev/ad1s1f mounted on /var
 	no snapshots found
 /dev/ad0s1g mounted on /spare
 	no snapshots found
 /dev/stripe/werehaus mounted on /a
 	snapshot /a/.snap/20060314-005900 (inode 3474)
 	snapshot /a/.snap/20060315-005901 (inode 3884)
 	snapshot /a/.snap/20060316-005900 (inode 3887)
 	snapshot /a/.snap/20060317-005900 (inode 221)
 	snapshot /a/.snap/20060318-005900 (inode 810)
 	snapshot /a/.snap/20060319-005900 (inode 1661)
 	snapshot /a/.snap/20060319-172149 (inode 4155)
 /snap/20060318-005900/home mounted on 
 	no snapshots found
 /snap/20060318-005900/a mounted on 
 	no snapshots found
 /snap/20060318-005900/slash mounted on 
 	no snapshots found
 /snap/20060318-005900/tmp mounted on 
 	no snapshots found
 /snap/20060319-005900/home mounted on 
 	no snapshots found
 /snap/20060319-005900/a mounted on 
 	no snapshots found
 /snap/20060319-005900/slash mounted on 
 	no snapshots found
 /snap/20060319-171958/usr mounted on 
 	no snapshots found
 /snap/20060319-172007/home mounted on 
 	no snapshots found
 /snap/20060319-172149/home mounted on 
 	no snapshots found
 /snap/20060319-172149/a mounted on 
 	no snapshots found
 /snap/20060319-172149/slash mounted on 
 	no snapshots found
 /snap/20060319-180812/usr mounted on 
 	no snapshots found
Responsible-Changed-From-To: freebsd-bugs->marks 
Responsible-Changed-By: marks 
Responsible-Changed-When: Mon Oct 9 13:21:05 UTC 2006 
Responsible-Changed-Why:  
As the original author of snapinfo(8) I'll have a go at this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=94635 
Responsible-Changed-From-To: marks->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Sep 29 14:32:23 UTC 2008 
Responsible-Changed-Why:  
marks has returned his bit for safekeeping. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=94635 

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@FreeBSD.org, ceri@submonkey.net
Cc:  
Subject: Re: bin/94635: snapinfo(8)/libufs only works for disk-backed
 filesystems
Date: Thu, 26 Mar 2009 21:18:03 +0000

 Rev 1.16 of src/lib/libufs/type.c and rev 1.2 of
 src/usr.sbin/snapinfo/snapinfo.c fixed the error where libufs was
 getting confused when a filesystem was manually mounted.  I attemped to
 replicate the issue on 7-STABLE with a swap-backed md filesystem and it
 correctly reported when snapshots were present or not, including when I
 created a file with the same inode number as a snapshot on another
 filesystem.   It looks like the fixes were only committed to 7.x and
 -CURRENT and were never MFC'd to 6.x.
 
 -- 
 Bruce
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: brucec 
Responsible-Changed-When: Fri Sep 24 20:53:37 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 
It looks like this issue has been fixed on 7.x and 8.x. Should the fix be merged 
to 6.x or can this PR be closed? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=94635 
State-Changed-From-To: open->closed 
State-Changed-By: jh 
State-Changed-When: Sat Feb 19 13:37:32 UTC 2011 
State-Changed-Why:  
Reportedly fixed in supported branches. 

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