Bug 94635 - snapinfo(8)/libufs only works for disk-backed filesystems
Summary: snapinfo(8)/libufs only works for disk-backed filesystems
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 6.1-PRERELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-18 11:10 UTC by Ceri Davies
Modified: 2011-02-19 13:37 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ceri Davies 2006-03-18 11:10:10 UTC
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

Fix: 

Fix libufs to return something useable in the non-disk case?
How-To-Repeat: 
Mount an md backed filesystem, and run snapinfo against it.
Comment 1 Ceri Davies 2006-03-19 19:49:08 UTC
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
Comment 2 marks freebsd_committer freebsd_triage 2006-10-09 14:21:05 UTC
Responsible Changed
From-To: freebsd-bugs->marks

As the original author of snapinfo(8) I'll have a go at this.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2008-09-29 15:32:23 UTC
Responsible Changed
From-To: marks->freebsd-bugs

marks has returned his bit for safekeeping.
Comment 4 Rebecca Cran freebsd_committer freebsd_triage 2009-03-26 21:18:03 UTC
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
Comment 5 Bruce Cran freebsd_committer freebsd_triage 2010-09-24 21:53:37 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

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?
Comment 6 Jaakko Heinonen freebsd_committer freebsd_triage 2011-02-19 13:37:32 UTC
State Changed
From-To: open->closed

Reportedly fixed in supported branches.