Kill the IN_RENAME in-core inode flag in ufs and ext2fs.

Now that rename works we need not to wave this sort of voodoo at it.

ok dholland
This commit is contained in:
riastradh 2012-06-04 20:13:47 +00:00
parent 93765c12f0
commit b8c3b27f99
5 changed files with 10 additions and 48 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_rename.c,v 1.3 2012/06/04 19:45:59 riastradh Exp $ */
/* $NetBSD: ext2fs_rename.c,v 1.4 2012/06/04 20:13:47 riastradh Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.3 2012/06/04 19:45:59 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.4 2012/06/04 20:13:47 riastradh Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -309,24 +309,11 @@ ext2fs_gro_rename(struct mount *mp, kauth_cred_t cred,
if ((nlink_t)VTOI(fvp)->i_e2fs_nlink >= LINK_MAX)
return EMLINK;
/*
* XXX There is a pile of logic here to handle a voodoo flag
* IN_RENAME. I think this is a vestige of days when the file
* system hackers didn't understand concurrency or race
* conditions; I believe it serves no useful function
* whatsoever.
*/
directory_p = (fvp->v_type == VDIR);
KASSERT(directory_p == ((VTOI(fvp)->i_e2fs_mode & IFMT) == IFDIR));
KASSERT((tvp == NULL) || (directory_p == (tvp->v_type == VDIR)));
KASSERT((tvp == NULL) || (directory_p ==
((VTOI(tvp)->i_e2fs_mode & IFMT) == IFDIR)));
if (directory_p) {
if (VTOI(fvp)->i_flag & IN_RENAME)
return EINVAL;
VTOI(fvp)->i_flag |= IN_RENAME;
}
reparent_p = (fdvp != tdvp);
KASSERT(reparent_p == (VTOI(fdvp)->i_number != VTOI(tdvp)->i_number));
@ -516,8 +503,6 @@ whymustithurtsomuch:
KASSERT(0 < VTOI(fvp)->i_e2fs_nlink);
VTOI(fvp)->i_e2fs_nlink--;
VTOI(fvp)->i_flag |= IN_CHANGE;
if (directory_p)
VTOI(fvp)->i_flag &=~ IN_RENAME;
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.h,v 1.60 2012/05/05 04:08:53 yamt Exp $ */
/* $NetBSD: inode.h,v 1.61 2012/06/04 20:13:47 riastradh Exp $ */
/*
* Copyright (c) 1982, 1989, 1993
@ -238,7 +238,7 @@ struct inode {
#define IN_MODIFY 0x2000 /* Modification time update request. */
#define IN_MODIFIED 0x0008 /* Inode has been modified. */
#define IN_ACCESSED 0x0010 /* Inode has been accessed. */
#define IN_RENAME 0x0020 /* Inode is being renamed. */
/* #define IN_UNUSED 0x0020 /* unused, was IN_RENAME */
#define IN_SHLOCK 0x0040 /* File has shared lock. */
#define IN_EXLOCK 0x0080 /* File has exclusive lock. */
#define IN_CLEANING 0x0100 /* LFS: file is being cleaned */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_rename.c,v 1.4 2012/06/04 19:58:57 riastradh Exp $ */
/* $NetBSD: ufs_rename.c,v 1.5 2012/06/04 20:13:47 riastradh Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_rename.c,v 1.4 2012/06/04 19:58:57 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_rename.c,v 1.5 2012/06/04 20:13:47 riastradh Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -321,24 +321,11 @@ ufs_gro_rename(struct mount *mp, kauth_cred_t cred,
if ((nlink_t)VTOI(fvp)->i_nlink >= LINK_MAX)
return EMLINK;
/*
* XXX There is a pile of logic here to handle a voodoo flag
* IN_RENAME. I think this is a vestige of days when the file
* system hackers didn't understand concurrency or race
* conditions; I believe it serves no useful function
* whatsoever.
*/
directory_p = (fvp->v_type == VDIR);
KASSERT(directory_p == ((VTOI(fvp)->i_mode & IFMT) == IFDIR));
KASSERT((tvp == NULL) || (directory_p == (tvp->v_type == VDIR)));
KASSERT((tvp == NULL) || (directory_p ==
((VTOI(tvp)->i_mode & IFMT) == IFDIR)));
if (directory_p) {
if (VTOI(fvp)->i_flag & IN_RENAME)
return EINVAL;
VTOI(fvp)->i_flag |= IN_RENAME;
}
reparent_p = (fdvp != tdvp);
KASSERT(reparent_p == (VTOI(fdvp)->i_number != VTOI(tdvp)->i_number));
@ -562,8 +549,6 @@ whymustithurtsomuch:
VTOI(fvp)->i_nlink--;
DIP_ASSIGN(VTOI(fvp), nlink, VTOI(fvp)->i_nlink);
VTOI(fvp)->i_flag |= IN_CHANGE;
if (directory_p)
VTOI(fvp)->i_flag &=~ IN_RENAME;
UFS_WAPBL_UPDATE(fvp, NULL, NULL, 0);
arghmybrainhurts:
@ -571,9 +556,6 @@ arghmybrainhurts:
ihateyou:
fstrans_done(mp);
/* XXX UFS kludge -- get rid of me with IN_RENAME! */
if (directory_p)
VTOI(fvp)->i_flag &=~ IN_RENAME;
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vnops.c,v 1.209 2012/05/09 00:21:18 riastradh Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.210 2012/06/04 20:13:47 riastradh Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.209 2012/05/09 00:21:18 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.210 2012/06/04 20:13:47 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -1173,10 +1173,6 @@ ufs_rmdir(void *v)
* directory and thus be non-empty.)
*/
error = 0;
if (ip->i_flag & IN_RENAME) {
error = EINVAL;
goto out;
}
if (ip->i_nlink != 2 ||
!ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) {
error = ENOTEMPTY;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pstat.c,v 1.118 2011/08/31 13:32:39 joerg Exp $ */
/* $NetBSD: pstat.c,v 1.119 2012/06/04 20:13:47 riastradh Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\
#if 0
static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95";
#else
__RCSID("$NetBSD: pstat.c,v 1.118 2011/08/31 13:32:39 joerg Exp $");
__RCSID("$NetBSD: pstat.c,v 1.119 2012/06/04 20:13:47 riastradh Exp $");
#endif
#endif /* not lint */
@ -453,7 +453,6 @@ const struct flagbit_desc ufs_flags[] = {
{ IN_UPDATE, 'U' },
{ IN_MODIFIED, 'M' },
{ IN_ACCESSED, 'a' },
{ IN_RENAME, 'R' },
{ IN_SHLOCK, 'S' },
{ IN_EXLOCK, 'E' },
{ IN_CLEANING, 'c' },