From owner-freebsd-fs@FreeBSD.ORG Thu Oct 22 20:10:04 2009 Return-Path: Delivered-To: freebsd-fs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20BF01065672 for ; Thu, 22 Oct 2009 20:10:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0FEED8FC12 for ; Thu, 22 Oct 2009 20:10:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n9MKA3Bm090956 for ; Thu, 22 Oct 2009 20:10:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n9MKA3YG090955; Thu, 22 Oct 2009 20:10:03 GMT (envelope-from gnats) Date: Thu, 22 Oct 2009 20:10:03 GMT Message-Id: <200910222010.n9MKA3YG090955@freefall.freebsd.org> To: freebsd-fs@FreeBSD.org From: Jaakko Heinonen Cc: Subject: Re: kern/139806: [zfs] [panic] Write attempt to file in ZFS snapshot dir causes panic X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jaakko Heinonen List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Oct 2009 20:10:04 -0000 The following reply was made to PR kern/139806; it has been noted by GNATS. From: Jaakko Heinonen To: Carl Chave Cc: bug-followup@FreeBSD.org 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