linux(4): Handle cas failure on ll/sc operations

Follow the 11a6ecd4. Check and handle the case when the ll/sc casu fails
even when the compare succeeds.

For more details PR/263825, https://reviews.freebsd.org/D35150.

Obtained from:		Andrew@
MFC after:		2 weeks
This commit is contained in:
Dmitry Chagin 2022-05-19 19:52:18 +03:00
parent 2479e381cd
commit 2cd662064a

View File

@ -410,6 +410,17 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args)
break;
}
/*
* Nobody owns it, but the acquire failed. This can happen
* with ll/sc atomic.
*/
if (owner == 0) {
error = thread_check_susp(td, true);
if (error != 0)
break;
continue;
}
/*
* Avoid overwriting a possible error from sleep due
* to the pending signal with suspension check result.