mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-03 18:20:25 +02:00 
			
		
		
		
	fs.rt.v5.18
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCYjr50AAKCRCRxhvAZXjc oroBAQC0daGrkl6XJirLzyMVjNWWbuSEdB+Q3ipMrwySxjYmtwD/XSPGAKGBbHQz 13EtvTMT8FlqSyDIKHYBM5uDyrWQZgs= =uJdq -----END PGP SIGNATURE----- Merge tag 'fs.rt.v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux Pull mount attributes PREEMPT_RT update from Christian Brauner: "This contains Sebastian's fix to make changing mount attributes/getting write access compatible with CONFIG_PREEMPT_RT. The change only applies when users explicitly opt-in to real-time via CONFIG_PREEMPT_RT otherwise things are exactly as before. We've waited quite a long time with this to make sure folks could take a good look" * tag 'fs.rt.v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux: fs/namespace: Boost the mount_lock.lock owner instead of spinning on PREEMPT_RT.
This commit is contained in:
		
						commit
						2e2d4650b3
					
				
					 1 changed files with 18 additions and 2 deletions
				
			
		| 
						 | 
					@ -344,8 +344,24 @@ int __mnt_want_write(struct vfsmount *m)
 | 
				
			||||||
	 * incremented count after it has set MNT_WRITE_HOLD.
 | 
						 * incremented count after it has set MNT_WRITE_HOLD.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	smp_mb();
 | 
						smp_mb();
 | 
				
			||||||
	while (READ_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD)
 | 
						might_lock(&mount_lock.lock);
 | 
				
			||||||
		cpu_relax();
 | 
						while (READ_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD) {
 | 
				
			||||||
 | 
							if (!IS_ENABLED(CONFIG_PREEMPT_RT)) {
 | 
				
			||||||
 | 
								cpu_relax();
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								/*
 | 
				
			||||||
 | 
								 * This prevents priority inversion, if the task
 | 
				
			||||||
 | 
								 * setting MNT_WRITE_HOLD got preempted on a remote
 | 
				
			||||||
 | 
								 * CPU, and it prevents life lock if the task setting
 | 
				
			||||||
 | 
								 * MNT_WRITE_HOLD has a lower priority and is bound to
 | 
				
			||||||
 | 
								 * the same CPU as the task that is spinning here.
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								preempt_enable();
 | 
				
			||||||
 | 
								lock_mount_hash();
 | 
				
			||||||
 | 
								unlock_mount_hash();
 | 
				
			||||||
 | 
								preempt_disable();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will
 | 
						 * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will
 | 
				
			||||||
	 * be set to match its requirements. So we must not load that until
 | 
						 * be set to match its requirements. So we must not load that until
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue