try to recycle "snap" vnodes as soon as possible

Those vnodes should not linger.  "Stale" nodes may get out of
synchronization with actual snapshots.  For example if we destroy a
snapshot and create a new one with the same name.  Or when we rename a
snapshot.

While there fix the argument type for zfsctl_snapshot_reclaim().
Also, its original argument can be passed to gfs_vop_reclaim() directly.

Bug 209093 could be related although I have not specifically verified
that.  Referencing just in case.

PR:		209093
MFC after:	5 weeks
This commit is contained in:
Andriy Gapon 2016-05-16 15:37:41 +00:00
parent 30f6480075
commit 9c3e205296

View File

@ -1490,17 +1490,28 @@ zfsctl_snapshot_mknode(vnode_t *pvp, uint64_t objset)
return (vp);
}
static int
zfsctl_snapshot_reclaim(ap)
zfsctl_snapshot_inactive(ap)
struct vop_inactive_args /* {
struct vnode *a_vp;
struct thread *a_td;
} */ *ap;
{
vnode_t *vp = ap->a_vp;
vrecycle(vp);
return (0);
}
static int
zfsctl_snapshot_reclaim(ap)
struct vop_reclaim_args /* {
struct vnode *a_vp;
struct thread *a_td;
} */ *ap;
{
vnode_t *vp = ap->a_vp;
cred_t *cr = ap->a_td->td_ucred;
struct vop_reclaim_args iap;
zfsctl_snapdir_t *sdp;
zfs_snapentry_t *sep, *next;
int locked;
@ -1543,8 +1554,7 @@ zfsctl_snapshot_reclaim(ap)
* "active". If we lookup the same name again we will end up
* creating a new vnode.
*/
iap.a_vp = vp;
gfs_vop_reclaim(&iap);
gfs_vop_reclaim(ap);
return (0);
}
@ -1597,7 +1607,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
*/
static struct vop_vector zfsctl_ops_snapshot = {
.vop_default = &default_vnodeops,
.vop_inactive = VOP_NULL,
.vop_inactive = zfsctl_snapshot_inactive,
.vop_reclaim = zfsctl_snapshot_reclaim,
.vop_vptocnp = zfsctl_snapshot_vptocnp,
};