Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it. Get this lock while renaming. Also add another relookup() in do_sys_rename, which is a hack to kludge around some of the worst deficiencies of ufs_rename. reviewed-by: pooka (and an earlier rev by ad) posted on tech-kern with no objections.
This commit is contained in:
parent
ff7363568f
commit
717e1785a5
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coda_vfsops.c,v 1.63 2008/01/15 18:11:25 ad Exp $ */
|
||||
/* $NetBSD: coda_vfsops.c,v 1.64 2008/01/28 14:31:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -45,7 +45,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.63 2008/01/15 18:11:25 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.64 2008/01/28 14:31:15 dholland Exp $");
|
||||
|
||||
#ifdef _LKM
|
||||
#define NVCODA 4
|
||||
@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.63 2008/01/15 18:11:25 ad Exp $");
|
||||
#include <coda/coda_opstats.h>
|
||||
/* for VN_RDEV */
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
|
||||
MALLOC_DEFINE(M_CODA, "coda", "Coda file system structures and tables");
|
||||
|
||||
@ -121,6 +122,8 @@ struct vfsops coda_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
coda_vnodeopv_descs,
|
||||
0, /* vfs_refcount */
|
||||
{ NULL, NULL }, /* vfs_list */
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files,v 1.888 2008/01/25 21:12:14 joerg Exp $
|
||||
# $NetBSD: files,v 1.889 2008/01/28 14:31:15 dholland Exp $
|
||||
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
|
||||
@ -1467,6 +1467,7 @@ file kern/vnode_if.c
|
||||
file miscfs/deadfs/dead_vnops.c
|
||||
file miscfs/fifofs/fifo_vnops.c
|
||||
file miscfs/genfs/genfs_io.c
|
||||
file miscfs/genfs/genfs_vfsops.c
|
||||
file miscfs/genfs/genfs_vnops.c
|
||||
file miscfs/genfs/layer_subr.c nullfs | overlay | umapfs | lkm
|
||||
file miscfs/genfs/layer_vfsops.c nullfs | overlay | umapfs | lkm
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: advfsops.c,v 1.47 2008/01/24 17:32:52 ad Exp $ */
|
||||
/* $NetBSD: advfsops.c,v 1.48 2008/01/28 14:31:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.47 2008/01/24 17:32:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.48 2008/01/28 14:31:15 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.47 2008/01/24 17:32:52 ad Exp $");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h> /* XXX */
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/namei.h>
|
||||
@ -826,6 +827,8 @@ struct vfsops adosfs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
adosfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cd9660_vfsops.c,v 1.54 2008/01/24 17:32:52 ad Exp $ */
|
||||
/* $NetBSD: cd9660_vfsops.c,v 1.55 2008/01/28 14:31:16 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.54 2008/01/24 17:32:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.55 2008/01/28 14:31:16 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.54 2008/01/24 17:32:52 ad Exp $"
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/buf.h>
|
||||
@ -105,6 +106,8 @@ struct vfsops cd9660_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
cd9660_vnodeopv_descs,
|
||||
0, /* refcount */
|
||||
{ NULL, NULL } /* list */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: filecore_vfsops.c,v 1.46 2008/01/24 17:32:53 ad Exp $ */
|
||||
/* $NetBSD: filecore_vfsops.c,v 1.47 2008/01/28 14:31:16 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The Regents of the University of California.
|
||||
@ -66,7 +66,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.46 2008/01/24 17:32:53 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.47 2008/01/28 14:31:16 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -77,6 +77,7 @@ __KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.46 2008/01/24 17:32:53 ad Exp
|
||||
#include <sys/namei.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/buf.h>
|
||||
@ -126,6 +127,8 @@ struct vfsops filecore_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
filecore_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL }
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hfs_vfsops.c,v 1.15 2008/01/25 20:49:15 ad Exp $ */
|
||||
/* $NetBSD: hfs_vfsops.c,v 1.16 2008/01/28 14:31:16 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
|
||||
@ -99,7 +99,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.15 2008/01/25 20:49:15 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.16 2008/01/28 14:31:16 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -128,6 +128,7 @@ __KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.15 2008/01/25 20:49:15 ad Exp $");
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
#include <fs/hfs/hfs.h>
|
||||
@ -164,6 +165,8 @@ struct vfsops hfs_vfsops = {
|
||||
NULL, /* vfs_snapshot */
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
hfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfs_vfsops.c,v 1.59 2008/01/24 17:32:53 ad Exp $ */
|
||||
/* $NetBSD: msdosfs_vfsops.c,v 1.60 2008/01/28 14:31:16 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.59 2008/01/24 17:32:53 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.60 2008/01/28 14:31:16 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.59 2008/01/24 17:32:53 ad Exp $
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h> /* XXX */ /* defines v_rdev */
|
||||
#include <sys/mount.h>
|
||||
#include <sys/buf.h>
|
||||
@ -132,6 +133,8 @@ struct vfsops msdosfs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
msdosfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ntfs_vfsops.c,v 1.61 2008/01/24 17:32:53 ad Exp $ */
|
||||
/* $NetBSD: ntfs_vfsops.c,v 1.62 2008/01/28 14:31:16 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 Semen Ustimenko
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.61 2008/01/24 17:32:53 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.62 2008/01/28 14:31:16 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.61 2008/01/24 17:32:53 ad Exp $");
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
#include <fs/ntfs/ntfs.h>
|
||||
@ -1002,6 +1003,8 @@ struct vfsops ntfs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
ntfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ptyfs_vfsops.c,v 1.30 2007/11/26 19:01:49 pooka Exp $ */
|
||||
/* $NetBSD: ptyfs_vfsops.c,v 1.31 2008/01/28 14:31:16 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1995
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.30 2007/11/26 19:01:49 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.31 2008/01/28 14:31:16 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -59,6 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.30 2007/11/26 19:01:49 pooka Exp
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <fs/ptyfs/ptyfs.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
MALLOC_JUSTDEFINE(M_PTYFSMNT, "ptyfs mount", "ptyfs mount structures");
|
||||
@ -393,6 +394,8 @@ struct vfsops ptyfs_vfsops = {
|
||||
(void *)eopnotsupp,
|
||||
(void *)eopnotsupp,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
ptyfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: puffs_vfsops.c,v 1.77 2008/01/03 18:09:35 pooka Exp $ */
|
||||
/* $NetBSD: puffs_vfsops.c,v 1.78 2008/01/28 14:31:17 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.77 2008/01/03 18:09:35 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.78 2008/01/28 14:31:17 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
@ -45,6 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.77 2008/01/03 18:09:35 pooka Exp
|
||||
|
||||
#include <dev/putter/putter_sys.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
|
||||
#include <fs/puffs/puffs_msgif.h>
|
||||
#include <fs/puffs/puffs_sys.h>
|
||||
|
||||
@ -828,6 +830,8 @@ struct vfsops puffs_vfsops = {
|
||||
puffs_vfsop_snapshot, /* snapshot */
|
||||
vfs_stdextattrctl, /* extattrctl */
|
||||
puffs_vfsop_suspendctl, /* suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
puffs_vnodeopv_descs, /* vnodeops */
|
||||
0, /* refcount */
|
||||
{ NULL, NULL }
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: smbfs_vfsops.c,v 1.76 2008/01/26 14:25:38 ad Exp $ */
|
||||
/* $NetBSD: smbfs_vfsops.c,v 1.77 2008/01/28 14:31:17 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000-2001, Boris Popov
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.76 2008/01/26 14:25:38 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.77 2008/01/28 14:31:17 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_quota.h"
|
||||
@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.76 2008/01/26 14:25:38 ad Exp $")
|
||||
#include <sys/stat.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
|
||||
|
||||
#include <netsmb/smb.h>
|
||||
@ -128,6 +129,8 @@ struct vfsops smbfs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
smbfs_vnodeopv_descs,
|
||||
0, /* vfs_refcount */
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sysvbfs.c,v 1.8 2008/01/25 14:32:13 ad Exp $ */
|
||||
/* $NetBSD: sysvbfs.c,v 1.9 2008/01/28 14:31:17 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sysvbfs.c,v 1.8 2008/01/25 14:32:13 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sysvbfs.c,v 1.9 2008/01/28 14:31:17 dholland Exp $");
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <sys/param.h>
|
||||
@ -133,6 +133,8 @@ struct vfsops sysvbfs_vfsops = {
|
||||
eopnotsupp, /* snapshot */
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
sysvbfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL }
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tmpfs_vfsops.c,v 1.35 2008/01/17 18:22:52 pooka Exp $ */
|
||||
/* $NetBSD: tmpfs_vfsops.c,v 1.36 2008/01/28 14:31:17 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
@ -49,7 +49,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.35 2008/01/17 18:22:52 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.36 2008/01/28 14:31:17 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.35 2008/01/17 18:22:52 pooka Exp
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <fs/tmpfs/tmpfs.h>
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
@ -439,6 +440,8 @@ struct vfsops tmpfs_vfsops = {
|
||||
tmpfs_snapshot, /* vfs_snapshot */
|
||||
vfs_stdextattrctl, /* vfs_extattrctl */
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
tmpfs_vnodeopv_descs,
|
||||
0, /* vfs_refcount */
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: udf_vfsops.c,v 1.34 2008/01/24 17:32:54 ad Exp $ */
|
||||
/* $NetBSD: udf_vfsops.c,v 1.35 2008/01/28 14:31:17 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Reinoud Zandijk
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.34 2008/01/24 17:32:54 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.35 2008/01/28 14:31:17 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.34 2008/01/24 17:32:54 ad Exp $");
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/buf.h>
|
||||
@ -129,6 +130,8 @@ struct vfsops udf_vfsops = {
|
||||
udf_snapshot,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
udf_vnodeopv_descs,
|
||||
0, /* int vfs_refcount */
|
||||
{ NULL, NULL, }, /* LIST_ENTRY(vfsops) */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: union_vfsops.c,v 1.50 2007/12/08 19:29:46 pooka Exp $ */
|
||||
/* $NetBSD: union_vfsops.c,v 1.51 2008/01/28 14:31:17 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 The Regents of the University of California.
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.50 2007/12/08 19:29:46 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.51 2008/01/28 14:31:17 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -481,6 +481,23 @@ union_vget(struct mount *mp, ino_t ino,
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static int
|
||||
union_renamelock_enter(struct mount *mp)
|
||||
{
|
||||
struct union_mount *um = MOUNTTOUNIONMOUNT(mp);
|
||||
|
||||
/* Lock just the upper fs, where the action happens. */
|
||||
return VFS_RENAMELOCK_ENTER(um->um_uppervp->v_mount);
|
||||
}
|
||||
|
||||
static void
|
||||
union_renamelock_exit(struct mount *mp)
|
||||
{
|
||||
struct union_mount *um = MOUNTTOUNIONMOUNT(mp);
|
||||
|
||||
VFS_RENAMELOCK_EXIT(um->um_uppervp->v_mount);
|
||||
}
|
||||
|
||||
SYSCTL_SETUP(sysctl_vfs_union_setup, "sysctl vfs.union subtree setup")
|
||||
{
|
||||
|
||||
@ -529,6 +546,8 @@ struct vfsops union_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
union_renamelock_enter,
|
||||
union_renamelock_exit,
|
||||
union_vnodeopv_descs,
|
||||
0, /* vfs_refcount */
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vfs_subr2.c,v 1.13 2008/01/24 17:32:55 ad Exp $ */
|
||||
/* $NetBSD: vfs_subr2.c,v 1.14 2008/01/28 14:31:18 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2004, 2005, 2007 The NetBSD Foundation, Inc.
|
||||
@ -82,7 +82,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_subr2.c,v 1.13 2008/01/24 17:32:55 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_subr2.c,v 1.14 2008/01/28 14:31:18 dholland Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -198,6 +198,7 @@ vfs_destroy(struct mount *mp)
|
||||
{
|
||||
|
||||
specificdata_fini(mount_specificdata_domain, &mp->mnt_specdataref);
|
||||
mutex_destroy(&mp->mnt_renamelock);
|
||||
mutex_destroy(&mp->mnt_mutex);
|
||||
lockdestroy(&mp->mnt_lock);
|
||||
free(mp, M_MOUNT);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vfs_syscalls.c,v 1.343 2008/01/25 14:32:15 ad Exp $ */
|
||||
/* $NetBSD: vfs_syscalls.c,v 1.344 2008/01/28 14:31:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.343 2008/01/25 14:32:15 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.344 2008/01/28 14:31:18 dholland Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_compat_43.h"
|
||||
@ -307,6 +307,7 @@ mount_domount(struct lwp *l, struct vnode **vpp, struct vfsops *vfsops,
|
||||
TAILQ_INIT(&mp->mnt_vnodelist);
|
||||
lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, 0);
|
||||
mutex_init(&mp->mnt_mutex, MUTEX_DEFAULT, IPL_NONE);
|
||||
mutex_init(&mp->mnt_renamelock, MUTEX_DEFAULT, IPL_NONE);
|
||||
(void)vfs_busy(mp, LK_NOWAIT, 0);
|
||||
|
||||
mp->mnt_vnodecovered = vp;
|
||||
@ -3278,8 +3279,10 @@ do_sys_rename(const char *from, const char *to, enum uio_seg seg, int retain)
|
||||
{
|
||||
struct vnode *tvp, *fvp, *tdvp;
|
||||
struct nameidata fromnd, tond;
|
||||
struct mount *fs;
|
||||
struct lwp *l = curlwp;
|
||||
struct proc *p;
|
||||
uint32_t saveflag;
|
||||
int error;
|
||||
|
||||
NDINIT(&fromnd, DELETE, LOCKPARENT | SAVESTART | TRYEMULROOT,
|
||||
@ -3289,11 +3292,57 @@ do_sys_rename(const char *from, const char *to, enum uio_seg seg, int retain)
|
||||
if (fromnd.ni_dvp != fromnd.ni_vp)
|
||||
VOP_UNLOCK(fromnd.ni_dvp, 0);
|
||||
fvp = fromnd.ni_vp;
|
||||
|
||||
fs = fvp->v_mount;
|
||||
error = VFS_RENAMELOCK_ENTER(fs);
|
||||
if (error) {
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
goto out1;
|
||||
}
|
||||
|
||||
/*
|
||||
* close, partially, yet another race - ideally we should only
|
||||
* go as far as getting fromnd.ni_dvp before getting the per-fs
|
||||
* lock, and then continue to get fromnd.ni_vp, but we can't do
|
||||
* that with namei as it stands.
|
||||
*
|
||||
* This still won't prevent rmdir from nuking fromnd.ni_vp
|
||||
* under us. The real fix is to get the locks in the right
|
||||
* order and do the lookups in the right places, but that's a
|
||||
* major rototill.
|
||||
*
|
||||
* Preserve the SAVESTART in cn_flags, because who knows what
|
||||
* might happen if we don't.
|
||||
*
|
||||
* Note: this logic (as well as this whole function) is cloned
|
||||
* in nfs_serv.c. Proceed accordingly.
|
||||
*/
|
||||
vrele(fvp);
|
||||
saveflag = fromnd.ni_cnd.cn_flags & SAVESTART;
|
||||
fromnd.ni_cnd.cn_flags &= ~SAVESTART;
|
||||
vn_lock(fromnd.ni_dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = relookup(fromnd.ni_dvp, &fromnd.ni_vp, &fromnd.ni_cnd);
|
||||
fromnd.ni_cnd.cn_flags |= saveflag;
|
||||
if (error) {
|
||||
VOP_UNLOCK(fromnd.ni_dvp, 0);
|
||||
VFS_RENAMELOCK_EXIT(fs);
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
goto out1;
|
||||
}
|
||||
VOP_UNLOCK(fromnd.ni_vp, 0);
|
||||
if (fromnd.ni_dvp != fromnd.ni_vp)
|
||||
VOP_UNLOCK(fromnd.ni_dvp, 0);
|
||||
fvp = fromnd.ni_vp;
|
||||
|
||||
NDINIT(&tond, RENAME,
|
||||
LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART | TRYEMULROOT
|
||||
| (fvp->v_type == VDIR ? CREATEDIR : 0),
|
||||
seg, to);
|
||||
if ((error = namei(&tond)) != 0) {
|
||||
VFS_RENAMELOCK_EXIT(fs);
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
@ -3351,6 +3400,7 @@ out:
|
||||
if (!error) {
|
||||
error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
|
||||
tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
|
||||
VFS_RENAMELOCK_EXIT(fs);
|
||||
} else {
|
||||
VOP_ABORTOP(tond.ni_dvp, &tond.ni_cnd);
|
||||
if (tdvp == tvp)
|
||||
@ -3359,6 +3409,7 @@ out:
|
||||
vput(tdvp);
|
||||
if (tvp)
|
||||
vput(tvp);
|
||||
VFS_RENAMELOCK_EXIT(fs);
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fdesc_vfsops.c,v 1.72 2008/01/02 11:48:58 ad Exp $ */
|
||||
/* $NetBSD: fdesc_vfsops.c,v 1.73 2008/01/28 14:31:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1995
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.72 2008/01/02 11:48:58 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.73 2008/01/28 14:31:18 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.72 2008/01/02 11:48:58 ad Exp $")
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/fdesc/fdesc.h>
|
||||
|
||||
VFS_PROTOS(fdesc);
|
||||
@ -277,6 +278,8 @@ struct vfsops fdesc_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
fdesc_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL},
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: genfs.h,v 1.22 2008/01/25 14:32:16 ad Exp $ */
|
||||
/* $NetBSD: genfs.h,v 1.23 2008/01/28 14:31:18 dholland Exp $ */
|
||||
|
||||
int genfs_badop(void *);
|
||||
int genfs_nullop(void *);
|
||||
@ -27,3 +27,6 @@ int genfs_null_putpages(void *);
|
||||
int genfs_compat_getpages(void *);
|
||||
|
||||
int genfs_do_putpages(struct vnode *, off_t, off_t, int, struct vm_page **);
|
||||
|
||||
int genfs_renamelock_enter(struct mount *);
|
||||
void genfs_renamelock_exit(struct mount *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: layer_extern.h,v 1.23 2007/11/26 19:02:13 pooka Exp $ */
|
||||
/* $NetBSD: layer_extern.h,v 1.24 2008/01/28 14:31:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 National Aeronautics & Space Administration
|
||||
@ -92,6 +92,8 @@ int layerfs_fhtovp(struct mount *, struct fid *, struct vnode **);
|
||||
int layerfs_vptofh(struct vnode *, struct fid *, size_t *);
|
||||
int layerfs_snapshot(struct mount *, struct vnode *,
|
||||
struct timespec *);
|
||||
int layerfs_renamelock_enter(struct mount *);
|
||||
void layerfs_renamelock_exit(struct mount *);
|
||||
|
||||
/* VOP routines */
|
||||
int layer_bypass(void *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: layer_vfsops.c,v 1.28 2007/12/08 15:10:22 ad Exp $ */
|
||||
/* $NetBSD: layer_vfsops.c,v 1.29 2008/01/28 14:31:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 National Aeronautics & Space Administration
|
||||
@ -73,7 +73,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: layer_vfsops.c,v 1.28 2007/12/08 15:10:22 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: layer_vfsops.c,v 1.29 2008/01/28 14:31:18 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
@ -307,3 +307,15 @@ SYSCTL_SETUP(sysctl_vfs_layerfs_setup, "sysctl vfs.layerfs subtree setup")
|
||||
* can't do that...not easily. not yet. :-)
|
||||
*/
|
||||
}
|
||||
|
||||
int
|
||||
layerfs_renamelock_enter(struct mount *mp)
|
||||
{
|
||||
return VFS_RENAMELOCK_ENTER(MOUNTTOLAYERMOUNT(mp)->layerm_vfs);
|
||||
}
|
||||
|
||||
void
|
||||
layerfs_renamelock_exit(struct mount *mp)
|
||||
{
|
||||
VFS_RENAMELOCK_EXIT(MOUNTTOLAYERMOUNT(mp)->layerm_vfs);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kernfs_vfsops.c,v 1.82 2007/11/26 19:02:14 pooka Exp $ */
|
||||
/* $NetBSD: kernfs_vfsops.c,v 1.83 2008/01/28 14:31:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1995
|
||||
@ -39,7 +39,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.82 2007/11/26 19:02:14 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.83 2008/01/28 14:31:18 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -58,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.82 2007/11/26 19:02:14 pooka Exp
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#include <miscfs/kernfs/kernfs.h>
|
||||
|
||||
@ -281,6 +282,8 @@ struct vfsops kernfs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
kernfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: null_vfsops.c,v 1.72 2008/01/02 11:49:00 ad Exp $ */
|
||||
/* $NetBSD: null_vfsops.c,v 1.73 2008/01/28 14:31:19 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 National Aeronautics & Space Administration
|
||||
@ -74,7 +74,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.72 2008/01/02 11:49:00 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.73 2008/01/28 14:31:19 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -296,6 +296,8 @@ struct vfsops nullfs_vfsops = {
|
||||
layerfs_snapshot,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
layerfs_renamelock_enter,
|
||||
layerfs_renamelock_exit,
|
||||
nullfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: overlay_vfsops.c,v 1.47 2008/01/02 11:49:01 ad Exp $ */
|
||||
/* $NetBSD: overlay_vfsops.c,v 1.48 2008/01/28 14:31:19 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000 National Aeronautics & Space Administration
|
||||
@ -74,7 +74,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.47 2008/01/02 11:49:01 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.48 2008/01/28 14:31:19 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -273,6 +273,8 @@ struct vfsops overlay_vfsops = {
|
||||
layerfs_snapshot,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
layerfs_renamelock_enter,
|
||||
layerfs_renamelock_exit,
|
||||
ov_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: portal_vfsops.c,v 1.69 2008/01/02 11:49:01 ad Exp $ */
|
||||
/* $NetBSD: portal_vfsops.c,v 1.70 2008/01/28 14:31:19 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1995
|
||||
@ -40,7 +40,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: portal_vfsops.c,v 1.69 2008/01/02 11:49:01 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: portal_vfsops.c,v 1.70 2008/01/28 14:31:19 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -66,6 +66,8 @@ __KERNEL_RCSID(0, "$NetBSD: portal_vfsops.c,v 1.69 2008/01/02 11:49:01 ad Exp $"
|
||||
#include <sys/un.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
|
||||
#include <miscfs/portal/portal.h>
|
||||
|
||||
VFS_PROTOS(portal);
|
||||
@ -304,6 +306,8 @@ struct vfsops portal_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
portal_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: procfs_vfsops.c,v 1.76 2007/12/26 16:01:37 ad Exp $ */
|
||||
/* $NetBSD: procfs_vfsops.c,v 1.77 2008/01/28 14:31:19 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993
|
||||
@ -76,7 +76,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.76 2007/12/26 16:01:37 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.77 2008/01/28 14:31:19 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -97,6 +97,8 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.76 2007/12/26 16:01:37 ad Exp $"
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
|
||||
#include <miscfs/procfs/procfs.h>
|
||||
|
||||
#include <uvm/uvm_extern.h> /* for PAGE_SIZE */
|
||||
@ -312,6 +314,8 @@ struct vfsops procfs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
procfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: umap_vfsops.c,v 1.74 2008/01/02 11:49:02 ad Exp $ */
|
||||
/* $NetBSD: umap_vfsops.c,v 1.75 2008/01/28 14:31:19 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.74 2008/01/02 11:49:02 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.75 2008/01/28 14:31:19 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -316,6 +316,8 @@ struct vfsops umapfs_vfsops = {
|
||||
layerfs_snapshot,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
layerfs_renamelock_enter,
|
||||
layerfs_renamelock_exit,
|
||||
umapfs_vnodeopv_descs,
|
||||
0, /* vfs_refcount */
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_serv.c,v 1.133 2007/12/22 03:31:15 yamt Exp $ */
|
||||
/* $NetBSD: nfs_serv.c,v 1.134 2008/01/28 14:31:19 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.133 2007/12/22 03:31:15 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.134 2008/01/28 14:31:19 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -1824,10 +1824,12 @@ nfsrv_rename(nfsd, slp, lwp, mrq)
|
||||
struct nameidata fromnd, tond;
|
||||
struct vnode *fvp, *tvp, *tdvp;
|
||||
struct vnode *fdirp = NULL, *tdirp = NULL;
|
||||
struct mount *localfs = NULL;
|
||||
struct vattr fdirfor, fdiraft, tdirfor, tdiraft;
|
||||
nfsrvfh_t fnsfh, tnsfh;
|
||||
u_quad_t frev;
|
||||
uid_t saved_uid;
|
||||
uint32_t saveflag;
|
||||
|
||||
#ifndef nolint
|
||||
fvp = (struct vnode *)0;
|
||||
@ -1861,6 +1863,35 @@ nfsrv_rename(nfsd, slp, lwp, mrq)
|
||||
VOP_UNLOCK(fromnd.ni_dvp, 0);
|
||||
}
|
||||
fvp = fromnd.ni_vp;
|
||||
|
||||
localfs = fvp->v_mount;
|
||||
error = VFS_RENAMELOCK_ENTER(localfs);
|
||||
if (error) {
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
goto out1;
|
||||
}
|
||||
|
||||
/* Copied, regrettably, from vfs_syscalls.c (q.v.) */
|
||||
vrele(fvp);
|
||||
saveflag = fromnd.ni_cnd.cn_flags & SAVESTART;
|
||||
fromnd.ni_cnd.cn_flags &= ~SAVESTART;
|
||||
vn_lock(fromnd.ni_dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = relookup(fromnd.ni_dvp, &fromnd.ni_vp, &fromnd.ni_cnd);
|
||||
fromnd.ni_cnd.cn_flags |= saveflag;
|
||||
if (error) {
|
||||
VOP_UNLOCK(fromnd.ni_dvp, 0);
|
||||
VFS_RENAMELOCK_EXIT(localfs);
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
goto out1;
|
||||
}
|
||||
VOP_UNLOCK(fromnd.ni_vp, 0);
|
||||
if (fromnd.ni_dvp != fromnd.ni_vp)
|
||||
VOP_UNLOCK(fromnd.ni_dvp, 0);
|
||||
fvp = fromnd.ni_vp;
|
||||
|
||||
nfsm_srvmtofh(&tnsfh);
|
||||
if (v3) {
|
||||
nfsm_dissect(tl, uint32_t *, NFSX_UNSIGNED);
|
||||
@ -1881,6 +1912,7 @@ nfsrv_rename(nfsd, slp, lwp, mrq)
|
||||
tdirfor_ret = VOP_GETATTR(tdirp, &tdirfor, cred);
|
||||
}
|
||||
if (error) {
|
||||
VFS_RENAMELOCK_EXIT(localfs);
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
@ -1949,6 +1981,7 @@ out:
|
||||
}
|
||||
error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
|
||||
tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
|
||||
VFS_RENAMELOCK_EXIT(localfs);
|
||||
} else {
|
||||
VOP_ABORTOP(tond.ni_dvp, &tond.ni_cnd);
|
||||
if (tdvp == tvp)
|
||||
@ -1957,6 +1990,7 @@ out:
|
||||
vput(tdvp);
|
||||
if (tvp)
|
||||
vput(tvp);
|
||||
VFS_RENAMELOCK_EXIT(localfs);
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
@ -1998,6 +2032,9 @@ nfsmout:
|
||||
vrele(tond.ni_startdir);
|
||||
PNBUF_PUT(tond.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
if (localfs) {
|
||||
VFS_RENAMELOCK_EXIT(localfs);
|
||||
}
|
||||
if (fromnd.ni_cnd.cn_nameiop) {
|
||||
vrele(fromnd.ni_startdir);
|
||||
PNBUF_PUT(fromnd.ni_cnd.cn_pnbuf);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.192 2008/01/20 18:09:13 joerg Exp $ */
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.193 2008/01/28 14:31:20 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1995
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.192 2008/01/20 18:09:13 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.193 2008/01/28 14:31:20 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -119,6 +119,8 @@ struct vfsops nfs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
nfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mount.h,v 1.171 2008/01/16 16:00:42 ad Exp $ */
|
||||
/* $NetBSD: mount.h,v 1.172 2008/01/28 14:31:20 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993
|
||||
@ -116,6 +116,7 @@ struct mount {
|
||||
int mnt_wcnt; /* count of vfs_busy waiters */
|
||||
struct lwp *mnt_unmounter; /* who is unmounting */
|
||||
kmutex_t mnt_mutex; /* mutex for wcnt */
|
||||
kmutex_t mnt_renamelock; /* per-fs rename lock */
|
||||
void *mnt_transinfo; /* for FS-internal use */
|
||||
specificdata_reference
|
||||
mnt_specdataref; /* subsystem specific data */
|
||||
@ -211,6 +212,8 @@ struct vfsops {
|
||||
int (*vfs_extattrctl) (struct mount *, int,
|
||||
struct vnode *, int, const char *);
|
||||
int (*vfs_suspendctl) (struct mount *, int);
|
||||
int (*vfs_renamelock_enter)(struct mount *);
|
||||
void (*vfs_renamelock_exit)(struct mount *);
|
||||
const struct vnodeopv_desc * const *vfs_opv_descs;
|
||||
int vfs_refcount;
|
||||
LIST_ENTRY(vfsops) vfs_list;
|
||||
@ -218,6 +221,8 @@ struct vfsops {
|
||||
|
||||
/* XXX Actually file system internal. */
|
||||
#define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
|
||||
#define VFS_RENAMELOCK_ENTER(MP) (*(MP)->mnt_op->vfs_renamelock_enter)(MP)
|
||||
#define VFS_RENAMELOCK_EXIT(MP) (*(MP)->mnt_op->vfs_renamelock_exit)(MP)
|
||||
|
||||
int VFS_MOUNT(struct mount *, const char *, void *, size_t *);
|
||||
int VFS_START(struct mount *, int);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_vfsops.c,v 1.128 2008/01/24 17:32:56 ad Exp $ */
|
||||
/* $NetBSD: ext2fs_vfsops.c,v 1.129 2008/01/28 14:31:20 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
@ -65,7 +65,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.128 2008/01/24 17:32:56 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.129 2008/01/28 14:31:20 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -93,6 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.128 2008/01/24 17:32:56 ad Exp $
|
||||
#include <sys/conf.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
#include <ufs/ufs/quota.h>
|
||||
@ -141,6 +142,8 @@ struct vfsops ext2fs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
ext2fs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.220 2008/01/25 10:49:32 pooka Exp $ */
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.221 2008/01/28 14:31:20 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.220 2008/01/25 10:49:32 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.221 2008/01/28 14:31:20 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -63,6 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.220 2008/01/25 10:49:32 pooka Exp $
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/fstrans.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
#include <ufs/ufs/quota.h>
|
||||
@ -111,6 +112,8 @@ struct vfsops ffs_vfsops = {
|
||||
ffs_snapshot,
|
||||
ffs_extattrctl,
|
||||
ffs_suspendctl,
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
ffs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.253 2008/01/24 17:32:57 ad Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.254 2008/01/28 14:31:20 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.253 2008/01/24 17:32:57 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.254 2008/01/28 14:31:20 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_lfs.h"
|
||||
@ -159,6 +159,8 @@ struct vfsops lfs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
lfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mfs_vfsops.c,v 1.87 2008/01/25 10:30:20 pooka Exp $ */
|
||||
/* $NetBSD: mfs_vfsops.c,v 1.88 2008/01/28 14:31:21 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1990, 1993, 1994
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.87 2008/01/25 10:30:20 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.88 2008/01/28 14:31:21 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.87 2008/01/25 10:30:20 pooka Exp $"
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#include <miscfs/syncfs/syncfs.h>
|
||||
|
||||
@ -105,6 +106,8 @@ struct vfsops mfs_vfsops = {
|
||||
(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
|
||||
vfs_stdextattrctl,
|
||||
(void *)eopnotsupp, /* vfs_suspendctl */
|
||||
genfs_renamelock_enter,
|
||||
genfs_renamelock_exit,
|
||||
mfs_vnodeopv_descs,
|
||||
0,
|
||||
{ NULL, NULL },
|
||||
|
Loading…
Reference in New Issue
Block a user