[Libguestfs] [PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.

Richard W.M. Jones rjones at redhat.com
Sat Jun 8 18:05:08 UTC 2019


v1 was here:

https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00055

v2 was here:

https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00067

v3:

 - Fix atomicly -> atomically in commit message.

 - Fix a comment.

 - Fix TOCTTOU: There is now an inline function generated called
   <name>_is_permitted_state, and this is called twice, first outside
   the lock for the quick rejection check, and again inside the lock
   in case the state changed.

I think an improvement would be to _drop_ the first check (outside the
lock).  This is an error check, so not performance critical since we
are definitely going to acquire the lock on the hot path.

Rich.





More information about the Libguestfs mailing list