]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC: 273641
authorjpaetzel <jpaetzel@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 9 Nov 2014 20:04:29 +0000 (20:04 +0000)
committerjpaetzel <jpaetzel@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 9 Nov 2014 20:04:29 +0000 (20:04 +0000)
commite3ae73e6fa7a5cf4570377ce8495118286b8dd5e
tree7bcc5da0cc3e61db02d394378289bd3400e8012d
parentaabccd4f6a6311a033b7d48af04af4769773cf8b
MFC: 273641

This change addresses 4 bugs in ZFS exposed by Richard Kojedzinszky's
crash.sh script attached to FreeNAS bug 4109:
https://bugs.freenas.org/issues/4109

Three are in the snapshot layer:
a) AVG explains in his notes: https://wiki.freebsd.org/AvgVfsSolarisVsFreeBSD

"VOP_INACTIVE must not do any destructive actions to a vnode
and its filesystem node, nor invalidate them in any way."
gfs_vop_inactive and zfsctl_snapshot_inactive did just that. In
OpenSolaris VOP_INACTIVE is much closer to FreeBSD's VOP_RECLAIM.
Rename & move them to gfs_vop_reclaim and zfsctl_snapshot_reclaim
and merge in the requisite vnode_destroy from zfsctl_common_reclaim.

b) gfs_lookup_dot and various zfsctl functions do not honor the
FreeBSD VFS convention of only locking from the root downward. When
looking up ".." the convention is to drop the current leaf vnode lock before
acquiring the directory vnode and then subsequently re-acquiring the lock on the
leaf vnode. This fixes that in all the places that our exercised by crash.sh.

c) The snapshot may already be unmounted when the directory vnode is reclaimed.
Check for this case and return.

One in the common layer:
d) Callers of traverse expect the reference to the vnode passed in to be
maintained. Don't release it.

This last one may be an unclear contract. There may in fact be some callers that
do expect the reference to be dropped on success in addition to callers that
expect it to be released. In this case a further audit of the callers is needed
and a consensus on the correct behavior.

PR:     184677
Submitted by: kmacy
Reviewed by: delphij, will, avg
Sponsored by: iXsystems

git-svn-id: svn://svn.freebsd.org/base/stable/10@274326 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h