Fix vnode corruption bug when trying to rename files across filesystems.
Similar to the bug fixed in smbfs_vnops.c rev 1.33.
This commit is contained in:
parent
e30fb64028
commit
2a42bccb40
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111603
@ -526,20 +526,22 @@ nwfs_rename(ap)
|
||||
error = EBUSY;
|
||||
goto out;
|
||||
}
|
||||
if (fvp->v_type == VDIR) {
|
||||
oldtype |= NW_TYPE_SUBDIR;
|
||||
} else if (fvp->v_type == VREG) {
|
||||
oldtype |= NW_TYPE_FILE;
|
||||
} else {
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (tvp && tvp != fvp) {
|
||||
error = ncp_DeleteNSEntry(nmp, VTONW(tdvp)->n_fid.f_id,
|
||||
tcnp->cn_namelen, tcnp->cn_nameptr,
|
||||
tcnp->cn_thread, tcnp->cn_cred);
|
||||
if (error == 0x899c) error = EACCES;
|
||||
if (error)
|
||||
goto out;
|
||||
goto out_cacherem;
|
||||
}
|
||||
if (fvp->v_type == VDIR) {
|
||||
oldtype |= NW_TYPE_SUBDIR;
|
||||
} else if (fvp->v_type == VREG) {
|
||||
oldtype |= NW_TYPE_FILE;
|
||||
} else
|
||||
return EINVAL;
|
||||
error = ncp_nsrename(NWFSTOCONN(nmp), nmp->n_volume, nmp->name_space,
|
||||
oldtype, &nmp->m.nls,
|
||||
VTONW(fdvp)->n_fid.f_id, fcnp->cn_nameptr, fcnp->cn_namelen,
|
||||
@ -553,6 +555,10 @@ nwfs_rename(ap)
|
||||
cache_purge(tdvp);
|
||||
cache_purge(fdvp);
|
||||
}
|
||||
out_cacherem:
|
||||
nwfs_attr_cacheremove(fdvp);
|
||||
nwfs_attr_cacheremove(tdvp);
|
||||
nwfs_attr_cacheremove(fvp);
|
||||
out:
|
||||
if (tdvp == tvp)
|
||||
vrele(tdvp);
|
||||
@ -562,9 +568,6 @@ nwfs_rename(ap)
|
||||
vput(tvp);
|
||||
vrele(fdvp);
|
||||
vrele(fvp);
|
||||
nwfs_attr_cacheremove(fdvp);
|
||||
nwfs_attr_cacheremove(tdvp);
|
||||
nwfs_attr_cacheremove(fvp);
|
||||
if (tvp)
|
||||
nwfs_attr_cacheremove(tvp);
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user