1/* $NetBSD: tmpfs_vnops.c,v 1.39 2007/07/23 15:41:01 jmmv Exp $ */ 2 3/*- 4 * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Julio M. Merino Vidal, developed as part of Google's Summer of Code --- 20 unchanged lines hidden (view full) --- 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33/* 34 * tmpfs vnode interface. 35 */ 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: stable/9/sys/fs/tmpfs/tmpfs_vnops.c 229855 2012-01-09 13:35:10Z ivoras $"); |
38 39#include <sys/param.h> 40#include <sys/fcntl.h> 41#include <sys/lockf.h> 42#include <sys/namei.h> 43#include <sys/priv.h> 44#include <sys/proc.h> 45#include <sys/sched.h> --- 914 unchanged lines hidden (view full) --- 960 /* If source and target are the same file, there is nothing to do. */ 961 if (fvp == tvp) { 962 error = 0; 963 goto out; 964 } 965 966 /* If we need to move the directory between entries, lock the 967 * source so that we can safely operate on it. */ |
968 if (fdvp != tdvp && fdvp != tvp) 969 vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); |
970 fdnode = VP_TO_TMPFS_DIR(fdvp); 971 fnode = VP_TO_TMPFS_NODE(fvp); 972 de = tmpfs_dir_lookup(fdnode, fnode, fcnp); 973 974 /* Entry can disappear before we lock fdvp, 975 * also avoid manipulating '.' and '..' entries. */ 976 if (de == NULL) { 977 if ((fcnp->cn_flags & ISDOTDOT) != 0 || --- 157 unchanged lines hidden (view full) --- 1135 * really reclaimed. */ 1136 tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE); 1137 } 1138 cache_purge(fvp); 1139 1140 error = 0; 1141 1142out_locked: |
1143 if (fdvp != tdvp && fdvp != tvp) |
1144 VOP_UNLOCK(fdvp, 0); 1145 1146out: 1147 /* Release target nodes. */ 1148 /* XXX: I don't understand when tdvp can be the same as tvp, but 1149 * other code takes care of this... */ 1150 if (tdvp == tvp) 1151 vrele(tdvp); --- 461 unchanged lines hidden --- |