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
7ea4339cac
commit
8e7930f85b
@ -526,20 +526,22 @@ nwfs_rename(ap)
|
|||||||
error = EBUSY;
|
error = EBUSY;
|
||||||
goto out;
|
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) {
|
if (tvp && tvp != fvp) {
|
||||||
error = ncp_DeleteNSEntry(nmp, VTONW(tdvp)->n_fid.f_id,
|
error = ncp_DeleteNSEntry(nmp, VTONW(tdvp)->n_fid.f_id,
|
||||||
tcnp->cn_namelen, tcnp->cn_nameptr,
|
tcnp->cn_namelen, tcnp->cn_nameptr,
|
||||||
tcnp->cn_thread, tcnp->cn_cred);
|
tcnp->cn_thread, tcnp->cn_cred);
|
||||||
if (error == 0x899c) error = EACCES;
|
if (error == 0x899c) error = EACCES;
|
||||||
if (error)
|
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,
|
error = ncp_nsrename(NWFSTOCONN(nmp), nmp->n_volume, nmp->name_space,
|
||||||
oldtype, &nmp->m.nls,
|
oldtype, &nmp->m.nls,
|
||||||
VTONW(fdvp)->n_fid.f_id, fcnp->cn_nameptr, fcnp->cn_namelen,
|
VTONW(fdvp)->n_fid.f_id, fcnp->cn_nameptr, fcnp->cn_namelen,
|
||||||
@ -553,6 +555,10 @@ nwfs_rename(ap)
|
|||||||
cache_purge(tdvp);
|
cache_purge(tdvp);
|
||||||
cache_purge(fdvp);
|
cache_purge(fdvp);
|
||||||
}
|
}
|
||||||
|
out_cacherem:
|
||||||
|
nwfs_attr_cacheremove(fdvp);
|
||||||
|
nwfs_attr_cacheremove(tdvp);
|
||||||
|
nwfs_attr_cacheremove(fvp);
|
||||||
out:
|
out:
|
||||||
if (tdvp == tvp)
|
if (tdvp == tvp)
|
||||||
vrele(tdvp);
|
vrele(tdvp);
|
||||||
@ -562,9 +568,6 @@ nwfs_rename(ap)
|
|||||||
vput(tvp);
|
vput(tvp);
|
||||||
vrele(fdvp);
|
vrele(fdvp);
|
||||||
vrele(fvp);
|
vrele(fvp);
|
||||||
nwfs_attr_cacheremove(fdvp);
|
|
||||||
nwfs_attr_cacheremove(tdvp);
|
|
||||||
nwfs_attr_cacheremove(fvp);
|
|
||||||
if (tvp)
|
if (tvp)
|
||||||
nwfs_attr_cacheremove(tvp);
|
nwfs_attr_cacheremove(tvp);
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user