Unable to pwd in ZFS snapshot

Jaakko Heinonen jh at saunalahti.fi
Mon Feb 9 07:55:26 PST 2009


Hi,

On 2009-02-08, Peter Jeremy wrote:
> I'm running -current from late last year (just after the ZFS v13
> import) and have found that I can't determine the current working
> directory inside a snapshot:

getcwd(3) first tries __getcwd() system call but it always fails because
the VFS name cache is not supported for .zfs control directories.
Secondly getcwd(3) tries to resolve working directory by traversing the
directory tree to root but this fails too because the .zfs directory is
normally hidden from the directory listing. (getcwd(3) uses readdir(3)
to find component names)

> This breaks (eg) make.  I got around it by cloning the snapshot but
> this behaviour strikes me as counter-intuitive (and the error message
> leaves something to be desired).

You can also work it around by making the ".zfs" directory visible:

	zfs set snapdir=visible volume

-- 
Jaakko


More information about the freebsd-fs mailing list