a relatively major problem with ext2.
Peter Edwards
peadar.edwards at gmail.com
Wed Mar 9 02:21:16 PST 2005
On Tue, 8 Mar 2005 20:54:44 -0600, Eric Kjeldergaard <kjelderg at gmail.com> wrote:
> After a bit of discussion on the kde list regarding a problem I've
> been having with kreadconfig (which uses mmap), I've stumbled (largely
> directed by Michael Nottebrock) upon an ext2 bug. Michael wrote and
> posted the following code:
> [snip mmap failures, crash]
Hi Eric,
Can you try the attached patch?
-------------- next part --------------
Index: sys/gnu/ext2fs/ext2_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/gnu/ext2fs/ext2_vnops.c,v
retrieving revision 1.97
diff -u -r1.97 ext2_vnops.c
--- sys/gnu/ext2fs/ext2_vnops.c 11 Jan 2005 09:10:45 -0000 1.97
+++ sys/gnu/ext2fs/ext2_vnops.c 9 Mar 2005 10:19:40 -0000
@@ -249,16 +249,21 @@
struct thread *a_td;
} */ *ap;
{
+ struct vnode *vp = ap->a_vp;
+ struct inode *ip;
- if (ap->a_vp->v_type == VBLK || ap->a_vp->v_type == VCHR)
+ if (vp->v_type == VBLK || vp->v_type == VCHR)
return (EOPNOTSUPP);
/*
* Files marked append-only must be opened for appending.
*/
- if ((VTOI(ap->a_vp)->i_flags & APPEND) &&
+ ip = VTOI(vp);
+ if ((ip->i_flags & APPEND) &&
(ap->a_mode & (FWRITE | O_APPEND)) == FWRITE)
return (EPERM);
+
+ vnode_create_vobject(vp, ip->i_size, ap->a_td);
return (0);
}
More information about the freebsd-current
mailing list