Add function vop_rename_fail(9) that performs needed cleanup for locks

and references of the VOP_RENAME(9) arguments. Use vop_rename_fail()
in deadfs_rename().

Tested by:	Mikolaj Golub
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2010-04-02 14:03:01 +00:00
parent c86819ec59
commit ea01588095
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206093
3 changed files with 18 additions and 8 deletions

View File

@ -225,13 +225,7 @@ dead_rename(ap)
struct componentname *a_tcnp;
} */ *ap;
{
if (ap->a_tvp)
vput(ap->a_tvp);
if (ap->a_tdvp == ap->a_tvp)
vrele(ap->a_tdvp);
else
vput(ap->a_tdvp);
vrele(ap->a_fdvp);
vrele(ap->a_fvp);
vop_rename_fail(ap);
return (EXDEV);
}

View File

@ -3750,6 +3750,20 @@ assert_vop_slocked(struct vnode *vp, const char *str)
#endif /* 0 */
#endif /* DEBUG_VFS_LOCKS */
void
vop_rename_fail(struct vop_rename_args *ap)
{
if (ap->a_tvp != NULL)
vput(ap->a_tvp);
if (ap->a_tdvp == ap->a_tvp)
vrele(ap->a_tdvp);
else
vput(ap->a_tdvp);
vrele(ap->a_fdvp);
vrele(ap->a_fvp);
}
void
vop_rename_pre(void *ap)
{

View File

@ -720,6 +720,8 @@ void vop_symlink_post(void *a, int rc);
void vop_unlock_post(void *a, int rc);
void vop_unlock_pre(void *a);
void vop_rename_fail(struct vop_rename_args *ap);
#define VOP_WRITE_PRE(ap) \
struct vattr va; \
int error, osize, ooffset, noffset; \