Date: Fri, 2 Apr 2010 14:03:43 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r206094 - head/sys/kern Message-ID: <201004021403.o32E3hsM076634@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Apr 2 14:03:43 2010 New Revision: 206094 URL: http://svn.freebsd.org/changeset/base/206094 Log: 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. PR: kern/107439 Based on submission by: Mikolaj Golub <to.my.trociny gmail com> Tested by: Mikolaj Golub MFC after: 1 week Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Fri Apr 2 14:03:01 2010 (r206093) +++ head/sys/kern/vfs_default.c Fri Apr 2 14:03:43 2010 (r206094) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vnode_pager.h> 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004021403.o32E3hsM076634>