Bug 204093

Summary: [zfs] Overflowing the max path for ZFS snapshot automount leaves the zfs in an busy state
Product: Base System Reporter: Matthew Seaman <matthew>
Component: binAssignee: freebsd-fs (Nobody) <fs>
Status: New ---    
Severity: Affects Some People    
Priority: ---    
Version: 10.2-RELEASE   
Hardware: Any   
OS: Any   

Description Matthew Seaman freebsd_committer freebsd_triage 2015-10-28 15:26:01 UTC
To reproduce, set up a zfs with snapshots like so:

{{{
# zfs list -t all -r tank/.......1
NAME                    USED  AVAIL  REFER  MOUNTPOINT
tank/.......1
                     19K   769G    19K  /.......1
tank/.......1@....3.........4.........5.........6.........7.........8........
                     0      -    19K  -
tank/.......1@....3.........4.........5.........6.........7.........8.........
                     0      -    19K  -
tank/.......1@....3.........4.........5.........6.........7.........8.........9.........0
                     0      -    19K  -
}}}

These names are carefully calculated to hit or exceed the 88 character limit on mountpoint path lengths when
the snapshots are automounted

Now, doing something that would cause the snapshots to automount leads to the expected 'name too long' errors:

{{{
# find /.......1/.zfs/snapshot
/.......1/.zfs/snapshot
find:
/.......1/.zfs/snapshot/....3.........4.........5.........6.........7.........8.........:
File name too long
/.......1/.zfs/snapshot/....3.........4.........5.........6.........7.........8........
/.......1/.zfs/snapshot/....3.........4.........5.........6.........7.........8......../aaa
/.......1/.zfs/snapshot/....3.........4.........5.........6.........7.........8......../aaa/bbb
/.......1/.zfs/snapshot/....3.........4.........5.........6.........7.........8......../aaa/bbb/ccc
find:
/.......1/.zfs/snapshot/....3.........4.........5.........6.........7.........8.........9.........0:
File name too long
}}}

This is all as expected.  Problem is that now the tank/.......1 zfs is left in a busy state:

{{{
# zfs destroy -r tank/.......1
cannot unmount '/.......1': Device busy
}}}

Needs a forced unmount to do anything with it:
{{{
# zfs umount -f /.......1
}}}

I'd expect that other than an error message there wouldn't be any side effects of failing to automount
a snapshot due to overflowing the maximum allowed path length.