Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/sysvbfs Sysvbfs_rename: Call bfs_file_delete(bfs, to_...
details: https://anonhg.NetBSD.org/src/rev/2be3a92207ec
branches: trunk
changeset: 335110:2be3a92207ec
user: hannken <hannken%NetBSD.org@localhost>
date: Fri Dec 26 15:22:15 2014 +0000
description:
Sysvbfs_rename: Call bfs_file_delete(bfs, to_name, true) before calling
bfs_file_rename() and remove the bfs_file_delete() from bfs_file_rename().
After calling bfs_file_rename() it was too late to set "tnode->removed"
as the inode already disappeared.
diffstat:
sys/fs/sysvbfs/bfs.c | 5 ++---
sys/fs/sysvbfs/sysvbfs_vnops.c | 22 ++++++++++++----------
2 files changed, 14 insertions(+), 13 deletions(-)
diffs (76 lines):
diff -r a524d5d376b4 -r 2be3a92207ec sys/fs/sysvbfs/bfs.c
--- a/sys/fs/sysvbfs/bfs.c Fri Dec 26 14:19:20 2014 +0000
+++ b/sys/fs/sysvbfs/bfs.c Fri Dec 26 15:22:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bfs.c,v 1.17 2014/01/09 13:23:57 hannken Exp $ */
+/* $NetBSD: bfs.c,v 1.18 2014/12/26 15:22:15 hannken Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bfs.c,v 1.17 2014/01/09 13:23:57 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bfs.c,v 1.18 2014/12/26 15:22:15 hannken Exp $");
#define BFS_DEBUG
#include <sys/param.h>
@@ -344,7 +344,6 @@
goto out;
}
- bfs_file_delete(bfs, to_name, false);
strncpy(dirent->name, to_name, BFS_FILENAME_MAXLEN);
bfs_writeback_dirent(bfs, dirent, false);
diff -r a524d5d376b4 -r 2be3a92207ec sys/fs/sysvbfs/sysvbfs_vnops.c
--- a/sys/fs/sysvbfs/sysvbfs_vnops.c Fri Dec 26 14:19:20 2014 +0000
+++ b/sys/fs/sysvbfs/sysvbfs_vnops.c Fri Dec 26 15:22:15 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysvbfs_vnops.c,v 1.54 2014/08/08 19:14:45 gson Exp $ */
+/* $NetBSD: sysvbfs_vnops.c,v 1.55 2014/12/26 15:22:15 hannken Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.54 2014/08/08 19:14:45 gson Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.55 2014/12/26 15:22:15 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -581,21 +581,23 @@
goto out;
}
+ /*
+ * Remove the target if it exists.
+ */
+ if (tvp != NULL) {
+ error = bfs_file_delete(bfs, to_name, true);
+ if (error)
+ goto out;
+ }
error = bfs_file_rename(bfs, from_name, to_name);
out:
- if (tvp) {
- if (error == 0) {
- struct sysvbfs_node *tbnode = tvp->v_data;
- tbnode->removed = 1;
- }
- vput(tvp);
- }
-
/* tdvp == tvp probably can't happen with this fs, but safety first */
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
+ if (tvp)
+ vput(tvp);
vrele(fdvp);
vrele(fvp);
Home |
Main Index |
Thread Index |
Old Index