Unbreak a few filesystems for which vnode_create_vobject() wasn't being

called in "open", causing mmap() to fail.

Where possible, pass size of file to vnode_create_vobject() rather
than having it find it out the hard way via VOP_LOOKUP

Reviewed by: phk
This commit is contained in:
peadar 2005-01-29 16:23:39 +00:00
parent d17bc56df3
commit a946eb65b0
6 changed files with 60 additions and 3 deletions

View File

@ -616,7 +616,7 @@ cd9660_fhtovp(mp, fhp, vpp)
return (ESTALE);
}
*vpp = nvp;
vnode_create_vobject(*vpp, 0, curthread);
vnode_create_vobject(*vpp, ip->i_size, curthread);
return (0);
}

View File

@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <isofs/cd9660/iso_rrip.h>
static vop_setattr_t cd9660_setattr;
static vop_open_t cd9660_open;
static vop_access_t cd9660_access;
static vop_getattr_t cd9660_getattr;
static vop_ioctl_t cd9660_ioctl;
@ -155,6 +156,23 @@ cd9660_access(ap)
ip->inode.iso_gid, ap->a_mode, ap->a_cred, NULL));
}
static int
cd9660_open(ap)
struct vop_open_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct thread *a_td;
int a_fdidx;
} */ *ap;
{
struct iso_node *ip = VTOI(ap->a_vp);
vnode_create_vobject(ap->a_vp, ip->i_size, ap->a_td);
return 0;
}
static int
cd9660_getattr(ap)
struct vop_getattr_args /* {
@ -782,6 +800,7 @@ cd9660_pathconf(ap)
*/
struct vop_vector cd9660_vnodeops = {
.vop_default = &default_vnodeops,
.vop_open = cd9660_open,
.vop_access = cd9660_access,
.vop_bmap = cd9660_bmap,
.vop_cachedlookup = cd9660_lookup,

View File

@ -87,6 +87,7 @@
static vop_advlock_t msdosfs_advlock;
static vop_create_t msdosfs_create;
static vop_mknod_t msdosfs_mknod;
static vop_open_t msdosfs_open;
static vop_close_t msdosfs_close;
static vop_access_t msdosfs_access;
static vop_getattr_t msdosfs_getattr;
@ -208,6 +209,21 @@ msdosfs_mknod(ap)
return (EINVAL);
}
static int
msdosfs_open(ap)
struct vop_open_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct thread *a_td;
int a_fdidx;
} */ *ap;
{
struct denode *dep = VTODE(ap->a_vp);
vnode_create_vobject(ap->a_vp, dep->de_FileSize, ap->a_td);
return 0;
}
static int
msdosfs_close(ap)
struct vop_close_args /* {
@ -1876,6 +1892,7 @@ struct vop_vector msdosfs_vnodeops = {
.vop_advlock = msdosfs_advlock,
.vop_bmap = msdosfs_bmap,
.vop_cachedlookup = msdosfs_lookup,
.vop_open = msdosfs_open,
.vop_close = msdosfs_close,
.vop_create = msdosfs_create,
.vop_fsync = msdosfs_fsync,

View File

@ -212,8 +212,10 @@ smbfs_open(ap)
error = smbfs_smb_open(np, accmode, &scred);
}
}
if (error == 0)
if (error == 0) {
np->n_flag |= NOPEN;
vnode_create_vobject(ap->a_vp, vattr.va_size, ap->a_td);
}
smbfs_attr_cacheremove(vp);
return error;
}

View File

@ -616,7 +616,7 @@ cd9660_fhtovp(mp, fhp, vpp)
return (ESTALE);
}
*vpp = nvp;
vnode_create_vobject(*vpp, 0, curthread);
vnode_create_vobject(*vpp, ip->i_size, curthread);
return (0);
}

View File

@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <isofs/cd9660/iso_rrip.h>
static vop_setattr_t cd9660_setattr;
static vop_open_t cd9660_open;
static vop_access_t cd9660_access;
static vop_getattr_t cd9660_getattr;
static vop_ioctl_t cd9660_ioctl;
@ -155,6 +156,23 @@ cd9660_access(ap)
ip->inode.iso_gid, ap->a_mode, ap->a_cred, NULL));
}
static int
cd9660_open(ap)
struct vop_open_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct thread *a_td;
int a_fdidx;
} */ *ap;
{
struct iso_node *ip = VTOI(ap->a_vp);
vnode_create_vobject(ap->a_vp, ip->i_size, ap->a_td);
return 0;
}
static int
cd9660_getattr(ap)
struct vop_getattr_args /* {
@ -782,6 +800,7 @@ cd9660_pathconf(ap)
*/
struct vop_vector cd9660_vnodeops = {
.vop_default = &default_vnodeops,
.vop_open = cd9660_open,
.vop_access = cd9660_access,
.vop_bmap = cd9660_bmap,
.vop_cachedlookup = cd9660_lookup,