summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/tmpfs
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/fs/tmpfs')
-rw-r--r--usr/src/uts/common/fs/tmpfs/tmp_vnops.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/usr/src/uts/common/fs/tmpfs/tmp_vnops.c b/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
index 61607a6dcc..3c251df0cc 100644
--- a/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
+++ b/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
@@ -25,7 +25,7 @@
*/
/*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2015, Joyent, Inc. All rights reserved.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
@@ -1185,6 +1185,7 @@ tmp_rename(
struct tmpnode *fromparent;
struct tmpnode *toparent;
struct tmpnode *fromtp = NULL; /* source tmpnode */
+ struct tmpnode *totp; /* target tmpnode */
struct tmount *tm = (struct tmount *)VTOTM(odvp);
int error;
int samedir = 0; /* set if odvp == ndvp */
@@ -1243,6 +1244,18 @@ tmp_rename(
goto done;
}
+ if (tdirlookup(toparent, nnm, &totp, cred) == 0) {
+ vnevent_pre_rename_dest(TNTOV(totp), ndvp, nnm, ct);
+ tmpnode_rele(totp);
+ }
+
+ /* Notify the target dir. if not the same as the source dir. */
+ if (ndvp != odvp) {
+ vnevent_pre_rename_dest_dir(ndvp, TNTOV(fromtp), nnm, ct);
+ }
+
+ vnevent_pre_rename_src(TNTOV(fromtp), odvp, onm, ct);
+
/*
* Link source to new target
*/
@@ -1262,15 +1275,6 @@ tmp_rename(
error = 0;
goto done;
}
- vnevent_rename_src(TNTOV(fromtp), odvp, onm, ct);
-
- /*
- * Notify the target directory if not same as
- * source directory.
- */
- if (ndvp != odvp) {
- vnevent_rename_dest_dir(ndvp, ct);
- }
/*
* Unlink from source.
@@ -1293,6 +1297,17 @@ tmp_rename(
rw_exit(&fromtp->tn_rwlock);
rw_exit(&fromparent->tn_rwlock);
+
+ if (error == 0) {
+ vnevent_rename_src(TNTOV(fromtp), odvp, onm, ct);
+ /*
+ * vnevent_rename_dest is called in tdirenter().
+ * Notify the target dir if not same as source dir.
+ */
+ if (ndvp != odvp)
+ vnevent_rename_dest_dir(ndvp, ct);
+ }
+
done:
tmpnode_rele(fromtp);
mutex_exit(&tm->tm_renamelck);