mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	btrfs: do commit in sync_fs if there are pending changes
If a pending change is requested, it's not processed unless there is a transaction commit about to happen, not even after sync or SYNC_FS ioctl. For example a remount that toggles the inode_cache option will not take effect after sync on a quiescent filesystem. Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
		
							parent
							
								
									572d9ab784
								
							
						
					
					
						commit
						6b5fe46dfa
					
				
					 1 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
					@ -993,10 +993,18 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
 | 
				
			||||||
	trans = btrfs_attach_transaction_barrier(root);
 | 
						trans = btrfs_attach_transaction_barrier(root);
 | 
				
			||||||
	if (IS_ERR(trans)) {
 | 
						if (IS_ERR(trans)) {
 | 
				
			||||||
		/* no transaction, don't bother */
 | 
							/* no transaction, don't bother */
 | 
				
			||||||
		if (PTR_ERR(trans) == -ENOENT)
 | 
							if (PTR_ERR(trans) == -ENOENT) {
 | 
				
			||||||
 | 
								/*
 | 
				
			||||||
 | 
								 * Exit unless we have some pending changes
 | 
				
			||||||
 | 
								 * that need to go through commit
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								if (fs_info->pending_changes == 0)
 | 
				
			||||||
				return 0;
 | 
									return 0;
 | 
				
			||||||
 | 
								trans = btrfs_start_transaction(root, 0);
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
			return PTR_ERR(trans);
 | 
								return PTR_ERR(trans);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return btrfs_commit_transaction(trans, root);
 | 
						return btrfs_commit_transaction(trans, root);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue