Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Feb 2010 22:09:23 +0200
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        Gleb Kurtsou <gleb.kurtsou@gmail.com>
Cc:        freebsd-fs@freebsd.org, Pawel Jakub Dawidek <pjd@FreeBSD.org>
Subject:   Re: Unable to pwd in ZFS snapshot
Message-ID:  <20100210200922.GA3109@a91-153-117-195.elisa-laajakaista.fi>
In-Reply-To: <20100205011226.GA2657@tops.skynet.lt>
References:  <4b473c1f1002032014y4da8c0f0xcb74c749332cced3@mail.gmail.com> <20100204205546.GA1733@garage.freebsd.pl> <20100205011226.GA2657@tops.skynet.lt>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2010-02-05, Gleb Kurtsou wrote:
> Comments in zfs_ctldir.c explain the inode numbering scheme under .zfs
> in detail, each snapshot node has to have unique inode number.  Correct
> inode number is returned by READDIR call, but not by GETATTR for the
> same vnode. This breaks our pwd (getcwd). The patch attached adds a hack
> to VOP_GETATTR to return expected inode numbers.
> 
> Also, with r197513 reverted all inode numbers are still the same, but it
> seems to work as expected.

r196309 added a VOP_VPTOCNP(9) implementation for snapshots. However due
to changes made in r197513 zfsctl_snapshot_vptocnp() never gets called.

There's also another problem with the hidden .zfs directory: if the
directory is not in the name cache, __getcwd() will fail. To reproduce
this set debug.vfscache sysctl to 0 before the directory enters to
cache.

# sysctl debug.vfscache=0
# cd /scratch/.zfs
# /bin/pwd
pwd: .: No such file or directory

Here's a patch which tries to fix/work around these problems:

	http://people.freebsd.org/~jh/patches/zfs-ctldir-vptocnp.diff

The patch needs more work and I have tested it only very lightly.

-- 
Jaakko



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100210200922.GA3109>