OSDN Git Service

fs/locks: allow a lock request to block other requests.
authorNeilBrown <neilb@suse.com>
Thu, 29 Nov 2018 23:04:08 +0000 (10:04 +1100)
committerJeff Layton <jlayton@kernel.org>
Fri, 30 Nov 2018 16:26:12 +0000 (11:26 -0500)
commit5946c4319ebb39af17fb9d6a606c866ce9b88740
tree0a59a57e7437bce636824f20a7225d3c8ad5a43c
parentd6367d6241371566597c9ab6efe4de0abf254eed
fs/locks: allow a lock request to block other requests.

Currently, a lock can block pending requests, but all pending
requests are equal.  If lots of pending requests are
mutually exclusive, this means they will all be woken up
and all but one will fail.  This can hurt performance.

So we will allow pending requests to block other requests.
Only the first request will be woken, and it will wake the others.

This patch doesn't implement this fully, but prepares the way.

- It acknowledges that a request might be blocking other requests,
  and when the request is converted to a lock, those blocked
  requests are moved across.
- When a request is requeued or discarded, all blocked requests are
  woken.
- When deadlock-detection looks for the lock which blocks a
  given request, we follow the chain of ->fl_blocker all
  the way to the top.

Tested-by: kernel test robot <rong.a.chen@intel.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/locks.c