Bug 157869 - easy to create zvols that cannot be forgotten
Summary: easy to create zvols that cannot be forgotten
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-14 08:30 UTC by Garrett Wollman
Modified: 2018-05-21 06:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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"