Skip to content

Commit

Permalink
fs: dlm: fix building without lockdep
Browse files Browse the repository at this point in the history
This patch uses assert_spin_locked() instead of lockdep_is_held()
where it's available to use because lockdep_is_held() is only available
if CONFIG_LOCKDEP is set.

In other cases like lockdep_sock_is_held() we surround it by a
CONFIG_LOCKDEP idef.

Fixes: dbb751f ("fs: dlm: parallelize lowcomms socket handling")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
  • Loading branch information
Alexander Aring authored and David Teigland committed Nov 22, 2022
1 parent dbb751f commit 7a5e9f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/dlm/lowcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ bool dlm_lowcomms_is_running(void)

static void lowcomms_queue_swork(struct connection *con)
{
WARN_ON_ONCE(!lockdep_is_held(&con->writequeue_lock));
assert_spin_locked(&con->writequeue_lock);

if (!test_bit(CF_IO_STOP, &con->flags) &&
!test_bit(CF_APP_LIMITED, &con->flags) &&
Expand All @@ -218,7 +218,9 @@ static void lowcomms_queue_swork(struct connection *con)

static void lowcomms_queue_rwork(struct connection *con)
{
#ifdef CONFIG_LOCKDEP
WARN_ON_ONCE(!lockdep_sock_is_held(con->sock->sk));
#endif

if (!test_bit(CF_IO_STOP, &con->flags) &&
!test_and_set_bit(CF_RECV_PENDING, &con->flags))
Expand Down Expand Up @@ -618,7 +620,9 @@ static void lowcomms_error_report(struct sock *sk)

static void restore_callbacks(struct sock *sk)
{
#ifdef CONFIG_LOCKDEP
WARN_ON_ONCE(!lockdep_sock_is_held(sk));
#endif

sk->sk_user_data = NULL;
sk->sk_data_ready = listen_sock.sk_data_ready;
Expand Down

0 comments on commit 7a5e9f1

Please sign in to comment.