Bug 157869

Summary: easy to create zvols that cannot be forgotten
Product: Base System Reporter: Garrett Wollman <wollman>
Component: kernAssignee: Bugmeister <bugmeister>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: avg, bugmeister
Priority: Normal    
Version: 8.2-RELEASE   
Hardware: Any   
OS: Any   

Description Garrett Wollman freebsd_committer freebsd_triage 2011-06-14 08:30:12 UTC
It is possible to create ZFS zvols with names that are too long to be
GEOM providers.  In fact, if the zvol is labeled (e.g., because the
zvol was used as a virtual drive on a virtual machine running
FreeBSD), it will instantiate multiple GEOM providers with the same
name which cannot be distinguished.  Furthermore, it will be
impossible to export the zpool where those zvols reside.

This is accompanied by a message on the console:
> WARNING: Device name truncated! (zvol/hergotha-tank-backup/vbox/devbox-9.0-current@backup-2011-0)

"zpool export" emits error messages the first time around:

> cannot open 'hergotha-tank-backup/vbox/devbox-9.0-currents1b': dataset does not exist
> cannot open 'hergotha-tank-backup/vbox/devbox-9.0-currents1a': dataset does not exist
> cannot open 'hergotha-tank-backup/vbox/devbox-9.0-currents1': dataset does not exist
> cannot export 'hergotha-tank-backup': pool is busy

At this point, devfs shows:

root@hergotha$ ls -l /dev/zvol/hergotha-tank-backup/vbox/
total 0
crw-r-----  1 root  operator    1,  22 Jun 14 02:31 devbox-9.0-current@backup-2011-0
crw-r-----  1 root  operator    1,  22 Jun 14 02:31 devbox-9.0-current@backup-2011-0
crw-r-----  1 root  operator    1,  22 Jun 14 02:31 devbox-9.0-current@backup-2011-0
crw-r-----  1 root  operator    1,  22 Jun 14 02:31 devbox-9.0-current@backup-2011-0
crw-r-----  1 root  operator    1,  22 Jun 14 02:31 devbox-9.0-current@backup-2011-0
crw-r-----  1 root  operator    1,  22 Jun 14 02:31 devbox-9.0-current@backup-2011-0
crw-r-----  1 root  operator    1,  22 Jun 14 02:31 devbox-9.0-current@backup-2011-0
crw-r-----  1 root  operator    1,  22 Jun 14 02:31 devbox-9.0-current@backup-2011-0

"zpool export -f" pretends to succeed, but the pool is still listed as
being online.  After this point, the "cannot export" message goes
away.  Removing the drive causes ZFS to realize that the pool has gone
offline.

Fix: 

ZFS should choose one of the following behaviors:

1) Don't instantiate GEOM providers whose names would be truncated.

2) Keep track of the GEOM providers in some other way that allows them
to be withered when the zpool is exported.

GEOM should probably be fixed to either make that warning an error, or
(preferably) lift the length limit to something a bit more reasonable
for ZFS.

-GAWollman
How-To-Repeat: 
Create a zvol with a long name (see above), and label it by installing FreeBSD
inside a virtual machine.
Comment 1 commit-hook freebsd_committer freebsd_triage 2015-06-20 11:31:47 UTC
A commit references this bug:

Author: kuriyama
Date: Sat Jun 20 11:31:12 UTC 2015
New revision: 390161
URL: https://svnweb.freebsd.org/changeset/ports/390161

Log:
  - Upgrade to 1.3138 (including some security issues).

  PR:		ports/157869
  Submitted by:	Henk van Oers <hvo.pm@xs4all.nl>
  References:	http://lists.preshweb.co.uk/pipermail/dancer-users/2015-June/004621.html

Changes:
  head/www/p5-Dancer/Makefile
  head/www/p5-Dancer/distinfo
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:51:45 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2024-11-25 06:03:35 UTC
^Triage: is this aging PR still relevant?
Comment 4 Garrett Wollman freebsd_committer freebsd_triage 2024-11-25 20:58:18 UTC
(In reply to Mark Linimon from comment #3)
No idea -- I haven't used zvols in many many years.