What distributed locks do you have in mind? Infinispan does not really offer any locking API, though it exposes the locks used to guard access to entries in pessimistic transactional cache. The is distributed locks API in JGroups but you should use different forum for that.
Speaking about locks in Infinispan, if you lock an entry during a transaction, it's locked until tx is committed or rolled back. TM usually has some timeout for the transaction and triggers a rollback if user does not complete the transaction explicitly - by default this is 1 minute with JBoss TM. So it's a responsibility of TM (on the origin node) to release the locks by doing rollback.
When a node leaves the cluster, all pending transactions originating on that node are cancelled. The suspect timeout depends on your JGroups settings, protocols FD* and VERIFY_SUSPECT handle that, plus there's some delay until the information propagates through Infinispan (but this is usually < 1s). See http://jgroups.org/manual/index.html#FailureDetection
Also, there's a periodic process searching for timed out transactions on each node - you can control transaction timeout and the period of the process through <transaction ... complete-timeout="60000" reaper-interval="30000" />