A file can be opened rw while ro-remounting is in progress resulting in open rw file on ro mounted filesystem. This patch kills the race by making permission check and the rest of open atomic w.r.t. remounting. Other file operations also have this race condition and should be fixed in similar manner.