mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Fix NULL pointer when O_SYNC read in snapshot
When doing read on a file open with O_SYNC, it will trigger zil_commit. However for snapshot, there's no zil, so we shouldn't be doing that. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: George Melikov <mail@gmelikov.ru> Signed-off-by: Chunwei Chen <david.chen@osnexus.com> Closes #6478 Closes #6494
This commit is contained in:
		
							parent
							
								
									2d9b57d39f
								
							
						
					
					
						commit
						aec4318870
					
				| @ -482,8 +482,10 @@ zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr) | |||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * If we're in FRSYNC mode, sync out this znode before reading it. | 	 * If we're in FRSYNC mode, sync out this znode before reading it. | ||||||
|  | 	 * Only do this for non-snapshots. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (ioflag & FRSYNC || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) | 	if (zfsvfs->z_log && | ||||||
|  | 	    (ioflag & FRSYNC || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)) | ||||||
| 		zil_commit(zfsvfs->z_log, zp->z_id); | 		zil_commit(zfsvfs->z_log, zp->z_id); | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Chunwei Chen
						Chunwei Chen