Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Aug 2011 10:32:47 -0400 (EDT)
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        Hiroki Sato <hrs@FreeBSD.org>
Cc:        pjd@FreeBSD.org, current@FreeBSD.org
Subject:   Re: fsid change of ZFS?
Message-ID:  <1623060518.69434.1313764367817.JavaMail.root@erie.cs.uoguelph.ca>
In-Reply-To: <20110819.224310.740411147168584392.hrs@allbsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hiroki Sato wrote:
> Hiroki Sato <hrs@freebsd.org> wrote
> in <20110819.002046.908756241495481148.hrs@allbsd.org>:
> 
> hr> Hi,
> hr>
> hr> I have experienced "Stale NFS file handle" issue when switching
> hr> between oldnfs and newnfs on a CURRENT box (NFS server exporting
> ZFS
> hr> mountpoints). The cause was that fsid was changed in the following
> hr> conditions and not in the NFS subsystem itself, but I am wondering
> if
> hr> these are expected behavior...
> hr>
> hr> First, I tried the following configurations of NFS and ZFS, and
> saw
> hr> if fsid of the same mountpoint (a mounted ZFS dataset) changed or
> hr> not by using statfs(2):
> hr>
> hr> compile opts kld module fsid[0:1] kld loaded by
> hr>
> ----------------------------------------------------------------------------
> hr> NFSSERVER+NFSCLIENT zfs 865798fa:8346ef02 loader
> hr>
> hr> NFSSERVER+NFSCLIENT zfs 865798fa:8346ef07 kldload(8)
> hr>
> hr> NFSSERVER+NFSCLIENT+
> hr> NFSD+NFSCL zfs 865798fa:8346ef03 loader
> hr>
> hr> NFSSERVER+NFSCLIENT+
> hr> NFSD+NFSCL zfs 865798fa:8346ef08 kldload(8)
> hr>
> hr> NFSSERVER+NFSCLIENT nfsd+nfscl+zfs 865798fa:8346ef08 loader
> hr>
> ----------------------------------------------------------------------------
> 
> Ah, I found why this happened:
> 
> /*
> * The fsid is 64 bits, composed of an 8-bit fs type, which
> * separates our fsid from any other filesystem types, and a
> * 56-bit objset unique ID. The objset unique ID is unique to
> * all objsets open on this system, provided by unique_create().
> * The 8-bit fs type must be put in the low bits of fsid[1]
> * because that's where other Solaris filesystems put it.
> */
> fsid_guid = dmu_objset_fsid_guid(zfsvfs->z_os);
> ASSERT((fsid_guid & ~((1ULL<<56)-1)) == 0);
> vfsp->vfs_fsid.val[0] = fsid_guid;
> vfsp->vfs_fsid.val[1] = ((fsid_guid>>32) << 8) |
> vfsp->mnt_vfc->vfc_typenum & 0xFF;
> 
> Since the vfc_typenum variable is incremented every time a new vfs is
> installed, loading order of modules that call vfs_register() affects
> ZFS's fsid.
> 
> Anyway, possibility of fsid change is troublesome especially for an
> NFS server with a lot of clients running. Can zeroing or setting a
> fixed value to the lowest 8-bit of vfs_fsid.val[1] be harmful?
> 
> -- Hiroki
Oh, and I think other fs types will suffer the same fate, except that
they usually avoid it, because they are compiled into the kernel and
the assignment of vfs_typenum happens in the same order-->same value.

My (B) suggestion would avoid this for all file system types in the
fixed table.

rick



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