Don't know the whole story, but they usually lock the bathrooms shortly before landing, but it's strange to do it during flight for 2 hours.
If it's turbulent, the flight attendants will make an announcement to stay seated, but won't they won't stop you from using the washroom if you really gotta go.