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

View: New views
4 Messages — Rating Filter:   Alert me  

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

by linimon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Old Synopsis: Write attempt to file in ZFS snapshot dir causes panic
New Synopsis: [zfs] [panic] Write attempt to file in ZFS snapshot dir causes panic

Responsible-Changed-From-To: freebsd-amd64->freebsd-fs
Responsible-Changed-By: linimon
Responsible-Changed-When: Wed Oct 21 20:15:16 UTC 2009
Responsible-Changed-Why:
Over to maintainer(s).

http://www.freebsd.org/cgi/query-pr.cgi?pr=139806
_______________________________________________
freebsd-fs@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "freebsd-fs-unsubscribe@..."

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

by jh-25 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

From: Jaakko Heinonen <jh@...>
To: Carl Chave <online@...>
Cc: bug-followup@...
Subject: Re: kern/139806: [zfs] [panic] Write attempt to file in ZFS
        snapshot dir causes panic
Date: Thu, 22 Oct 2009 22:50:56 +0300

 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
 ===================================================================
 --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c (revision 198368)
 +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c (working copy)
 @@ -3989,7 +3989,12 @@
  struct thread *a_td;
  } */ *ap;
  {
 + int error;
 
 + error = zfs_access(ap->a_vp, ap->a_accmode, 0, ap->a_cred, NULL);
 + if (error != 0)
 + return (error);
 +
  /*
  * ZFS itself only knowns about VREAD, VWRITE and VEXEC, the rest
  * we have to handle by calling vaccess().
 @@ -3999,11 +4004,11 @@
  znode_t *zp = VTOZ(vp);
  znode_phys_t *zphys = zp->z_phys;
 
 - return (vaccess(vp->v_type, zphys->zp_mode, zphys->zp_uid,
 -    zphys->zp_gid, ap->a_accmode, ap->a_cred, NULL));
 + error = vaccess(vp->v_type, zphys->zp_mode, zphys->zp_uid,
 +    zphys->zp_gid, ap->a_accmode, ap->a_cred, NULL);
  }
 
 - return (zfs_access(ap->a_vp, ap->a_accmode, 0, ap->a_cred, NULL));
 + return (error);
  }
 
  static int
 --- patch ends here ---
 
 --
 Jaakko
_______________________________________________
freebsd-fs@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "freebsd-fs-unsubscribe@..."

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

by Carl Chave-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

From: Carl Chave <carl@...>
To: bug-followup@...
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@...> 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
 >
_______________________________________________
freebsd-fs@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "freebsd-fs-unsubscribe@..."

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

by Pawel Jakub Dawidek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Synopsis: [zfs] [panic] Write attempt to file in ZFS snapshot dir causes panic

State-Changed-From-To: open->patched
State-Changed-By: pjd
State-Changed-When: ptk 30 pa¼ 2009 23:33:39 UTC
State-Changed-Why:
Fix committed to HEAD. Thank you for the report!


Responsible-Changed-From-To: freebsd-fs->pjd
Responsible-Changed-By: pjd
Responsible-Changed-When: ptk 30 pa¼ 2009 23:33:39 UTC
Responsible-Changed-Why:
I'll take this one.

http://www.freebsd.org/cgi/query-pr.cgi?pr=139806
_______________________________________________
freebsd-fs@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "freebsd-fs-unsubscribe@..."