On Mon, Aug 12, 2019 at 04:00:19PM -0400, J. Bruce Fields wrote: > On Mon, Aug 12, 2019 at 03:16:47PM -0400, Olga Kornievskaia wrote: > > On Mon, Aug 12, 2019 at 12:19 PM Olga Kornievskaia > > <olga.kornievskaia@xxxxxxxxx> wrote: > > > While this passes my testing, in theory this allows for the race that > > > we get the copy notify size but then offload_cancel arrive and change > > > the value. Then refcount_sub_and test_check would have an incorrect > > > value (can subtract larger than an actual reference count). I have no > > > solution for that as there is no refcount_sub_and_lock() that will > > > allow to decrement by a multiple under a lock. Thoughts? > > > > I tried not to use the client's cl_lock but instead use a specific > > lock to protect the copy notifies stateid on the stateid list. But > > since stateid's reference counter (sc_count) is protected by it, I > > think by getting rid of the special lock and using cl_lock will solve > > the problem of coordinating access between the sc_count and the > > copy_notify stateid list. Are the any problems with using such a big > > lock? > > Probably not. But it can be confusing when a single lock is used for > several different things. A comment explaining why you need it might > help. (By which I mean, a comment in the code.) --b.