There are many possible solutions:
Obtain a "session ID" through stat and always use that to access the file:
id := stat("/a")
read(id)
write(id, ..) // doesn't protect race access to a file,
// but at least you're not using the
// pathname twice, which already solves a
// lot of problems
Use transactions:
transid := ftransopen()
f := stat("/a")
read("/a")
write("/a", ..)
ftransend(transid) // fails if clashes with other fs changes
Have "last modification ID" counters that change for every modification to a file, and allow CAS-style operations:
mod := stat_mod("/a")
open_mod("/a", mod)
read_mod("/a", mod)
mod2 := write_mod("/a", ..., mod) // fails if /a modified since mod
mod3 := chown_mod("/a", ..., mod2) // fails if modified since mod2
etc.
All with their own pros and cons, of course, but definitely possible. I'm just curious if there's a specific implementation that's gaining momentum.