Subject: Re: File system suspension -- new API
To: None <tech-kern@netbsd.org, wrstuden@netbsd.org,>
From: Pavel Cahyna <pavel@netbsd.org>
List: tech-kern
Date: 12/31/2006 11:12:52
On Fri, Dec 29, 2006 at 04:34:45PM +0100, Juergen Hannken-Illjes wrote:
> +/*
> + * Lock the node.
> + */
> +int
> +ufs_lock(void *v)
> +{
> +	struct vop_lock_args /* {
> +		struct vnode *a_vp;
> +		int a_flags;
> +	} */ *ap = v;
> +	struct vnode *vp = ap->a_vp;
> +	struct mount *mp = vp->v_mount;
> +
> +	/*
> +	 * Fake lock during file system suspension.
> +	 */
> +	if ((vp->v_type == VREG || vp->v_type == VDIR) &&
> +	    fstrans_is_owner(mp) &&
> +	    fstrans_getstate(mp) == fstrans_suspending) {
> +		if ((ap->a_flags & LK_INTERLOCK) != 0)
> +			simple_unlock(&vp->v_interlock);
> +		return 0;

How is safe to "fake" a lock? If the caller wants to lock something, it
probably does not expect the lock to be "faked".

Why is it needed at all?

Pavel