Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Oct 2008 13:20:05 GMT
From:      "Weldon Godfrey" <wgodfrey@ena.com>
To:        freebsd-fs@FreeBSD.org
Subject:   RE: kern/125149: [zfs][nfs] changing into .zfs dir from nfsclientcauses endless panic loop
Message-ID:  <200810101320.m9ADK5g4063010@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/125149; it has been noted by GNATS.

From: "Weldon Godfrey" <wgodfrey@ena.com>
To: "Jaakko Heinonen" <jh@saunalahti.fi>
Cc: <bug-followup@freebsd.org>
Subject: RE: kern/125149: [zfs][nfs] changing into .zfs dir from nfsclientcauses endless panic loop
Date: Fri, 10 Oct 2008 08:11:17 -0500

 That's okay, although I won't be able to help test since I am close to
 using the system in production.  We can live without needing to go to
 .zfs directory from a client.  Also, I have set the nordirplus option on
 the clients now. =20
 
 Which, btw, could this also be the other issue I was seeing?  When we
 tested rigoriously from CentOS 3.x clients, after 2-3 hrs of testing,
 the system would panic.  From the fbsd-fs list, it was noted from the
 backtrace that the vnode was becoming invalid.  This seemed to be less
 of a case with CentOS 5.x clients (by a lot, although I did get 1 panic
 recently).  I am rerunning the tests over this weekend.
 
 Thank you for helping!
 
 Weldon
 
 -----Original Message-----
 From: Jaakko Heinonen [mailto:jh@saunalahti.fi]=20
 Sent: Thursday, October 09, 2008 2:45 PM
 To: Weldon Godfrey
 Cc: bug-followup@freebsd.org
 Subject: Re: kern/125149: [zfs][nfs] changing into .zfs dir from
 nfsclientcauses endless panic loop
 
 On 2008-10-09, Weldon Godfrey wrote:
 > Is this patch based on 8-CURRENT or 7-RELEASE?  If 8-CURRENT, I don't
 > know if I can test as I would like to stick with 7-RELEASE for now.
 
 Patches are against head. Sorry that I didn't mention that. The nfs
 patch applies against RELENG_7 with offset and here's the zfs patch
 against RELENG_7. (Disclaimer: compile tested only)
 
 %%%
 Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
 (revision 183727)
 +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	(working
 copy)
 @@ -759,9 +759,10 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla
  		VN_RELE(ZTOV(zp));
  		err =3D EINVAL;
  	}
 -	if (err !=3D 0)
 -		*vpp =3D NULL;
 -	else {
 +	if (err !=3D 0) {
 +		/* try .zfs control directory */
 +		err =3D zfsctl_vget(vfsp, ino, flags, vpp);
 +	} else {
  		*vpp =3D ZTOV(zp);
  		vn_lock(*vpp, flags, curthread);
  	}
 Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
 (revision 183727)
 +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	(working
 copy)
 @@ -1044,6 +1044,63 @@ zfsctl_lookup_objset(vfs_t *vfsp, uint64
  	return (error);
  }
 =20
 +int
 +zfsctl_vget(vfs_t *vfsp, uint64_t nodeid, int flags, vnode_t **vpp)
 +{
 +	zfsvfs_t *zfsvfs =3D vfsp->vfs_data;
 +	vnode_t *dvp, *vp;
 +	zfsctl_snapdir_t *sdp;
 +	zfsctl_node_t *zcp;
 +	zfs_snapentry_t *sep;
 +	int error;
 +
 +	*vpp =3D NULL;
 +
 +	ASSERT(zfsvfs->z_ctldir !=3D NULL);
 +	error =3D zfsctl_root_lookup(zfsvfs->z_ctldir, "snapshot", &dvp,
 +	    NULL, 0, NULL, kcred);
 +	if (error !=3D 0)
 +		return (error);
 +
 +	if (nodeid =3D=3D ZFSCTL_INO_ROOT || nodeid =3D=3D ZFSCTL_INO_SNAPDIR) =
 {
 +		if (nodeid =3D=3D ZFSCTL_INO_SNAPDIR)
 +			*vpp =3D dvp;
 +		else {
 +			VN_RELE(dvp);
 +			*vpp =3D zfsvfs->z_ctldir;
 +			VN_HOLD(*vpp);
 +		}
 +		/* XXX: LK_RETRY? */
 +		vn_lock(*vpp, flags | LK_RETRY, curthread);
 +		return (0);
 +	}
 +	=09
 +	sdp =3D dvp->v_data;
 +
 +	mutex_enter(&sdp->sd_lock);
 +	sep =3D avl_first(&sdp->sd_snaps);
 +	while (sep !=3D NULL) {
 +		vp =3D sep->se_root;
 +		zcp =3D vp->v_data;
 +		if (zcp->zc_id =3D=3D nodeid)
 +			break;
 +
 +		sep =3D AVL_NEXT(&sdp->sd_snaps, sep);
 +	}
 +
 +	if (sep !=3D NULL) {
 +		VN_HOLD(vp);
 +		*vpp =3D vp;
 +		vn_lock(*vpp, flags, curthread);
 +	} else
 +		error =3D EINVAL;
 +
 +	mutex_exit(&sdp->sd_lock);
 +
 +	VN_RELE(dvp);
 +
 +	return (error);
 +}
  /*
   * Unmount any snapshots for the given filesystem.  This is called from
   * zfs_umount() - if we have a ctldir, then go through and unmount all
 the
 Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h
 (revision 183727)
 +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h
 (working copy)
 @@ -60,6 +60,7 @@ int zfsctl_root_lookup(vnode_t *dvp, cha
      int flags, vnode_t *rdir, cred_t *cr);
 =20
  int zfsctl_lookup_objset(vfs_t *vfsp, uint64_t objsetid, zfsvfs_t
 **zfsvfsp);
 +int zfsctl_vget(vfs_t *vfsp, uint64_t nodeid, int flags, vnode_t
 **vpp);
 =20
  #define	ZFSCTL_INO_ROOT		0x1
  #define	ZFSCTL_INO_SNAPDIR	0x2
 %%%
 
 --=20
 Jaakko



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