kern/139806: [zfs] [panic] Write attempt to file in ZFS snapshot dir causes panic

Carl Chave carl at chave.us
Sun Oct 25 16:00:19 UTC 2009


The following reply was made to PR kern/139806; it has been noted by GNATS.

From: Carl Chave <carl at chave.us>
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: kern/139806: [zfs] [panic] Write attempt to file in ZFS snapshot 
	dir causes panic
Date: Sun, 25 Oct 2009 10:47:40 -0400

 Rebuilt zfs.ko using:
 
 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
 (version 197861 + this patch)
 head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c (version 197861)
 head/sys/cddl/compat/opensolaris/sys/policy.h (version 197861)
 
 Resulting zfs.ko works as expected and does not panic when attempting
 to modify an existing snapshot file as described in the original PR.
 
 On Thu, Oct 22, 2009 at 3:50 PM, Jaakko Heinonen <jh at freebsd.org> wrote:
 >
 > Hi,
 >
 > On 2009-10-21, Carl Chave wrote:
 >> Fixit# echo hello >> test.txt
 >> panic: dirtying snapshot!
 >
 > The problem seems to be that in certain conditions zfs_freebsd_access()
 > uses only vaccess(9) for access check. However vaccess(9) doesn't handle
 > the read-only file system case.
 >
 > Could you try this patch?
 >
 > --- patch begins here ---
 > Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 > --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c =A0(revisi=
 on 198368)
 > +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c =A0(workin=
 g copy)
 > @@ -3989,7 +3989,12 @@
 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct thread *a_td;
 > =A0 =A0 =A0 =A0} */ *ap;
 > =A0{
 > + =A0 =A0 =A0 int error;
 >
 > + =A0 =A0 =A0 error =3D zfs_access(ap->a_vp, ap->a_accmode, 0, ap->a_cred=
 , NULL);
 > + =A0 =A0 =A0 if (error !=3D 0)
 > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (error);
 > +
 > =A0 =A0 =A0 =A0/*
 > =A0 =A0 =A0 =A0 * ZFS itself only knowns about VREAD, VWRITE and VEXEC, t=
 he rest
 > =A0 =A0 =A0 =A0 * we have to handle by calling vaccess().
 > @@ -3999,11 +4004,11 @@
 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0znode_t *zp =3D VTOZ(vp);
 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0znode_phys_t *zphys =3D zp->z_phys;
 >
 > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (vaccess(vp->v_type, zphys->zp_mode,=
  zphys->zp_uid,
 > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 zphys->zp_gid, ap->a_accmode, ap->a=
 _cred, NULL));
 > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D vaccess(vp->v_type, zphys->zp_mod=
 e, zphys->zp_uid,
 > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 zphys->zp_gid, ap->a_accmode, ap->a=
 _cred, NULL);
 > =A0 =A0 =A0 =A0}
 >
 > - =A0 =A0 =A0 return (zfs_access(ap->a_vp, ap->a_accmode, 0, ap->a_cred, =
 NULL));
 > + =A0 =A0 =A0 return (error);
 > =A0}
 >
 > =A0static int
 > --- patch ends here ---
 >
 > --
 > Jaakko
 >


More information about the freebsd-fs mailing list