@@ -656,11 +656,7 @@ func (c *Client) Lock(ctx context.Context, target string, mods ...func(*Req)) (R
656656 return Res {}, fmt .Errorf ("failed to establish connection: %w" , err )
657657 }
658658
659- // Acquire write lock since this modifies device state
660- c .mu .Lock ()
661- defer c .mu .Unlock ()
662-
663- // Build request
659+ // Build request (no lock needed - just building a struct)
664660 req := & Req {
665661 Operation : "lock" ,
666662 Target : target ,
@@ -671,7 +667,8 @@ func (c *Client) Lock(ctx context.Context, target string, mods ...func(*Req)) (R
671667 mod (req )
672668 }
673669
674- // Send RPC and parse response
670+ // Send RPC without holding mutex - driver has its own synchronization
671+ // and waitForLockRelease may recursively call Lock() to test availability
675672 return c .sendRPC (ctx , req )
676673}
677674
@@ -693,11 +690,7 @@ func (c *Client) Unlock(ctx context.Context, target string, mods ...func(*Req))
693690 return Res {}, fmt .Errorf ("failed to establish connection: %w" , err )
694691 }
695692
696- // Acquire write lock since this modifies device state
697- c .mu .Lock ()
698- defer c .mu .Unlock ()
699-
700- // Build request
693+ // Build request (no lock needed - just building a struct)
701694 req := & Req {
702695 Operation : "unlock" ,
703696 Target : target ,
@@ -708,7 +701,7 @@ func (c *Client) Unlock(ctx context.Context, target string, mods ...func(*Req))
708701 mod (req )
709702 }
710703
711- // Send RPC and parse response
704+ // Send RPC without holding mutex - driver has its own synchronization
712705 return c .sendRPC (ctx , req )
713706}
714707
0 commit comments