No, this is expected behavior due to the limitations of NFS.  The
problem is that .zfs/snapshot is technically a separate filesystem, but
due to limitations in NFS (although mirror mounts might solve this), we
have to present it as a single filesystem.  This means that we have
multiple filesystems sharing the same inode space.  Because we must
accomodate the 32-bit inode space for the majority of clients, stealing
bits out of this space would severely limit the number of files
available in snapshots (or the number of snapshots), and never truly
solve the problem.

For the NFS protocol, we have a large (48-byte I think) FID that can
truly differentiate between one file and another.  So at the protocol
layer we're fine.  But at the OS layer, it sees a single filesystem with
the same inode in multiple places.  So if you do a 'cp' from one
snapshot over the same live file, the utility tries to be clever and
tell you it's the same file.

On the local filesystem, we have control over the fsid returned to the
application.  So we can have different fsids so even though there is
(visible) mount.  On a local system, the inodes are the same but the
fsids are different so the cp(1) command will behave normally.

Unfortunately, there is little we can do to solve this situation over
NFS.  If you have ever used NetApp's .snapshot directory, you'll find
the same problem (or at least as of a few years ago when I was still in
school using a filer).  They play the same crazy game with the NFS FID
(so that '..' will take out out of the .snapshot directory, for
example), but they have the same OS-level limitations for the
fsid/inode.

- Eric

On Mon, Jul 03, 2006 at 08:39:41PM -0500, James Dickens wrote:
> Hi
> 
> i found a bug its a bit hard to reproduce.
> 
> 
> # zfs create pool2/t1
> # touch /pool2/t1/file
> # zfs snapshot pool2/[EMAIL PROTECTED]
> # zfs clone pool2/[EMAIL PROTECTED] pool2/t2
> # zfs share pool2/t2
> 
> on a second box nfs mount the filesystem,  same error if a solaris
> express box or linux
> 
> # mount enterprise:/pool2/t2 /export/home/test
> # cd /export/home/test/
> # cp .zfs/snapshot/snapshot/file .
> cp: .zfs/snapshot/snapshot/file and ./file are identical
> # echo "test test" >> file
> # cp .zfs/snapshot/snapshot/file .
> cp: .zfs/snapshot/snapshot/file and ./file are identical
> #
> 
> this works as expected, or if done on the local system, if the file
> was not part of the clone.
> 
> # uname -av
> SunOS enterprise 5.11 snv_39 sun4u sparc SUNW,Ultra-2
> #
> 
> James Dickens
> uadmin.blogspot.com
> _______________________________________________
> zfs-discuss mailing list
> zfs-discuss@opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

--
Eric Schrock, Solaris Kernel Development       http://blogs.sun.com/eschrock
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to