diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c index ddbcfa2076..72ff463846 100644 --- a/fs/vfs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -249,8 +249,6 @@ next_subdir: errout_with_lock: inode_unlock(); -errout: - RELEASE_SEARCH(&newdesc); #ifdef CONFIG_FS_NOTIFY if (ret >= 0) { @@ -258,6 +256,8 @@ errout: } #endif +errout: + RELEASE_SEARCH(&newdesc); if (subdir != NULL) { lib_free(subdir); @@ -462,6 +462,13 @@ next_subdir: ret = oldinode->u.i_mops->rename(oldinode, oldrelpath, newrelpath); +#ifdef CONFIG_FS_NOTIFY + if (ret >= 0) + { + notify_rename(oldpath, oldisdir, newpath, newisdir); + } +#endif + errout_with_newinode: inode_release(newinode); @@ -472,13 +479,6 @@ errout_with_newsearch: lib_free(subdir); } -#ifdef CONFIG_FS_NOTIFY - if (ret >= 0) - { - notify_rename(oldpath, oldisdir, newpath, newisdir); - } -#endif - return ret; } #endif /* CONFIG_DISABLE_MOUNTPOINT */