mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	zfs_sync: remove support for impossible scenarios
The superblock pointer will always be set, as will z_log, so remove code supporting cases that can't occur (on Linux at least). Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Paul Dagnelie <paul.dagnelie@klarasystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #17420
This commit is contained in:
		
							parent
							
								
									c758072b2f
								
							
						
					
					
						commit
						d944641502
					
				| @ -265,6 +265,7 @@ zfs_sync(struct super_block *sb, int wait, cred_t *cr) | ||||
| { | ||||
| 	(void) cr; | ||||
| 	zfsvfs_t *zfsvfs = sb->s_fs_info; | ||||
| 	ASSERT3P(zfsvfs, !=, NULL); | ||||
| 
 | ||||
| 	/*
 | ||||
| 	 * Semantically, the only requirement is that the sync be initiated. | ||||
| @ -273,38 +274,21 @@ zfs_sync(struct super_block *sb, int wait, cred_t *cr) | ||||
| 	if (!wait) | ||||
| 		return (0); | ||||
| 
 | ||||
| 	if (zfsvfs != NULL) { | ||||
| 		/*
 | ||||
| 		 * Sync a specific filesystem. | ||||
| 		 */ | ||||
| 		dsl_pool_t *dp; | ||||
| 		int error; | ||||
| 
 | ||||
| 		if ((error = zfs_enter(zfsvfs, FTAG)) != 0) | ||||
| 			return (error); | ||||
| 		dp = dmu_objset_pool(zfsvfs->z_os); | ||||
| 	int err = zfs_enter(zfsvfs, FTAG); | ||||
| 	if (err != 0) | ||||
| 		return (err); | ||||
| 
 | ||||
| 	/*
 | ||||
| 	 * If the system is shutting down, then skip any | ||||
| 	 * filesystems which may exist on a suspended pool. | ||||
| 	 */ | ||||
| 		if (spa_suspended(dp->dp_spa)) { | ||||
| 	if (spa_suspended(zfsvfs->z_os->os_spa)) { | ||||
| 		zfs_exit(zfsvfs, FTAG); | ||||
| 		return (0); | ||||
| 	} | ||||
| 
 | ||||
| 		if (zfsvfs->z_log != NULL) | ||||
| 	zil_commit(zfsvfs->z_log, 0); | ||||
| 
 | ||||
| 	zfs_exit(zfsvfs, FTAG); | ||||
| 	} else { | ||||
| 		/*
 | ||||
| 		 * Sync all ZFS filesystems.  This is what happens when you | ||||
| 		 * run sync(1).  Unlike other filesystems, ZFS honors the | ||||
| 		 * request by waiting for all pools to commit all dirty data. | ||||
| 		 */ | ||||
| 		spa_sync_allpools(); | ||||
| 	} | ||||
| 
 | ||||
| 	return (0); | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rob Norris
						Rob Norris