Hi,
On Thu, Jul 13, 2023 at 12:49 PM Alexander Aring aahringo@redhat.com wrote:
This patch implements dlm plock F_SETLKW interruption feature. If the pending plock operation is not sent to user space yet it can simple be dropped out of the send_list. In case it's already being sent we need to try to remove the waiters in dlm user space tool. If it was successful a reply with DLM_PLOCK_OP_CANCEL optype instead of DLM_PLOCK_OP_LOCK comes back (flag DLM_PLOCK_FL_NO_REPLY was then being cleared in user space) to signal the cancellation was successful. If a result with optype DLM_PLOCK_OP_LOCK came back then the cancellation was not successful.
There is another use-case for this op that's only used kernel internally by nfs. It's F_CANCELLK [0]. I will try to implement this feature as I think the current behaviour is broken [1]. An unlock is not a revert and if the lock request is in waiting state, unlocking will do exactly nothing.
I am still questioning how the API of [0] is supposed to work as [0] does not evaluate any return value if it was successfully canceled or not. Maybe they meant cancel and if it was not successful unlock it, but an unlock is not a revert and posix locks support up/downgrade locking e.g. read/write locks. However I think unlocking if cancellation wasn't successful is meant here.
Besides that, I will change that DLM_PLOCK_OP_CANCEL will always expect a reply back.
- Alex
[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/l... [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/g...