From owner-svn-src-stable-8@FreeBSD.ORG Fri Apr 9 08:45:30 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 823BF106568D; Fri, 9 Apr 2010 08:45:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56B068FC13; Fri, 9 Apr 2010 08:45:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o398jUXw055139; Fri, 9 Apr 2010 08:45:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o398jU6J055136; Fri, 9 Apr 2010 08:45:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201004090845.o398jU6J055136@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 9 Apr 2010 08:45:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206414 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2010 08:45:30 -0000 Author: kib Date: Fri Apr 9 08:45:30 2010 New Revision: 206414 URL: http://svn.freebsd.org/changeset/base/206414 Log: MFC r206094: Supply default implementation of VOP_RENAME() that does neccessary unlocks and unreferences for argument vnodes, as expected by kern_renameat(9), and returns EOPNOTSUPP. This fixes locks and reference leaks when rename is attempted on fs that does not implement rename. Modified: stable/8/sys/kern/vfs_default.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/vfs_default.c ============================================================================== --- stable/8/sys/kern/vfs_default.c Fri Apr 9 08:39:28 2010 (r206413) +++ stable/8/sys/kern/vfs_default.c Fri Apr 9 08:45:30 2010 (r206414) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include static int vop_nolookup(struct vop_lookup_args *); +static int vop_norename(struct vop_rename_args *); static int vop_nostrategy(struct vop_strategy_args *); static int get_next_dirent(struct vnode *vp, struct dirent **dpp, char *dirbuf, int dirbuflen, off_t *off, @@ -113,6 +114,7 @@ struct vop_vector default_vnodeops = { .vop_poll = vop_nopoll, .vop_putpages = vop_stdputpages, .vop_readlink = VOP_EINVAL, + .vop_rename = vop_norename, .vop_revoke = VOP_PANIC, .vop_strategy = vop_nostrategy, .vop_unlock = vop_stdunlock, @@ -206,6 +208,20 @@ vop_nolookup(ap) } /* + * vop_norename: + * + * Handle unlock and reference counting for arguments of vop_rename + * for filesystems that do not implement rename operation. + */ +static int +vop_norename(struct vop_rename_args *ap) +{ + + vop_rename_fail(ap); + return (EOPNOTSUPP); +} + +/* * vop_nostrategy: * * Strategy routine for VFS devices that have none.