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

Jaakko Heinonen jh at FreeBSD.org
Thu Oct 22 20:10:04 UTC 2009


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

From: Jaakko Heinonen <jh at FreeBSD.org>
To: Carl Chave <online at chave.us>
Cc: bug-followup at 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


More information about the freebsd-fs mailing list