diff options
author | tjr <tjr@FreeBSD.org> | 2003-02-27 08:26:17 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2003-02-27 08:26:17 +0000 |
commit | 8e7930f85b79149c516b4d63de15dfcc61a33888 (patch) | |
tree | cf820590ff4f9ef7cd04b41bb98d74a22388f272 /sys/fs/nwfs | |
parent | 7ea4339cac9f94df284a74f6e1ad693980b18000 (diff) | |
download | FreeBSD-src-8e7930f85b79149c516b4d63de15dfcc61a33888.zip FreeBSD-src-8e7930f85b79149c516b4d63de15dfcc61a33888.tar.gz |
Fix vnode corruption bug when trying to rename files across filesystems.
Similar to the bug fixed in smbfs_vnops.c rev 1.33.
Diffstat (limited to 'sys/fs/nwfs')
-rw-r--r-- | sys/fs/nwfs/nwfs_vnops.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c index aae9ac0..59dc234 100644 --- a/sys/fs/nwfs/nwfs_vnops.c +++ b/sys/fs/nwfs/nwfs_vnops.c @@ -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 @@ out: vput(tvp); vrele(fdvp); vrele(fvp); - nwfs_attr_cacheremove(fdvp); - nwfs_attr_cacheremove(tdvp); - nwfs_attr_cacheremove(fvp); if (tvp) nwfs_attr_cacheremove(tvp); /* |