diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2016-02-24 15:00:37 +0000 |
|---|---|---|
| committer | Robert Mustacchi <rm@joyent.com> | 2016-03-23 14:18:49 -0700 |
| commit | 54207fd2e1e7ed01d0416da8cf296dbef920fbfc (patch) | |
| tree | 46fdbbb9c1a0f2df431fb764311aaf5ca1425b0d /usr/src/uts/common/fs/tmpfs | |
| parent | 257b568661af68ce9df60ea121105e7709216a53 (diff) | |
| download | illumos-joyent-54207fd2e1e7ed01d0416da8cf296dbef920fbfc.tar.gz | |
4242 file rename event fires before the rename happens
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Marcel Telka <marcel@telka.sk>
Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/uts/common/fs/tmpfs')
| -rw-r--r-- | usr/src/uts/common/fs/tmpfs/tmp_vnops.c | 35 |
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); |
