Please post new versions of a patch in a separate thread from the original one. > +static bool loop_try_update_state_locked(struct loop_device *lo, const int old, const int new) Pleae avoid the overly long line. Also passing arguments as const is a little weird. > { > + bool ret = false; > > + lockdep_assert_held(&lo->lo_mutex); > + spin_lock(&loop_validate_spinlock); > + if (lo->lo_state == old) { > + lo->lo_state = new; > + ret = true; > } > + spin_unlock(&loop_validate_spinlock); > + return ret; But I really wonder what the point of this helper is. IMHO it would be much easier to follow if it was open coded in the functions that update the state (that is without the loop_try_update_state helper as well). But going one step further: What is protected by loop_validate_spinlock and what is protected by lo->lo_mutex now? Or in other words, if we decided the lo_state is protected by loop_validate_spinlock why do we even need lo_mutex here now?