Skip to contentSkip to conversation

DLM: Remove lock_sock to avoid scheduling while atomic

PATCH New Bob Peterson 1 participant 2 messages Oct 10, 2016 – Oct 19, 2016 1 message not in the archive Distributed lock manager (DLM)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 DLM: Remove lock_sock to avoid scheduling while atomic

Hi,

Before this patch, functions save_callbacks and restore_callbacks called function lock_sock and release_sock to prevent other processes from messing with the struct sock while the callbacks were saved and restored. However, function add_sock calls write_lock_bh prior to calling it save_callbacks, which disables preempts. So the call to lock_sock would try to schedule when we can't schedule.

---

fs/dlm/lowcomms.c +0 -4
index 963016c..8c41dbe 100644
@@ -519,24 +519,20 @@ out:
 /* Note: sk_callback_lock must be locked before calling this function. */
 static void save_callbacks(struct connection *con, struct sock *sk)
 {
-	lock_sock(sk);
 	con->orig_data_ready = sk->sk_data_ready;
 	con->orig_state_change = sk->sk_state_change;
 	con->orig_write_space = sk->sk_write_space;
 	con->orig_error_report = sk->sk_error_report;
-	release_sock(sk);
 }
 
 static void restore_callbacks(struct connection *con, struct sock *sk)
 {
 	write_lock_bh(&sk->sk_callback_lock);
-	lock_sock(sk);
 	sk->sk_user_data = NULL;
 	sk->sk_data_ready = con->orig_data_ready;
 	sk->sk_state_change = con->orig_state_change;
 	sk->sk_write_space = con->orig_write_space;
 	sk->sk_error_report = con->orig_error_report;
-	release_sock(sk);
 	write_unlock_bh(&sk->sk_callback_lock);
 }
 
#2 lore raw

PATCH 1/1 DLM: Remove lock_sock to avoid scheduling while atomic

----- Original Message -----

| Hi,
| 
| Before this patch, functions save_callbacks and restore_callbacks
| called function lock_sock and release_sock to prevent other processes
| from messing with the struct sock while the callbacks were saved and
| restored. However, function add_sock calls write_lock_bh prior to
| calling it save_callbacks, which disables preempts. So the call to
| lock_sock would try to schedule when we can't schedule.
| 
| Signed-off-by: Bob Peterson <[email protected]>
| ---

Hi Dave,

Same question, different patch: Any word on this patch from 10 October?

Regards,

Bob Peterson
Red Hat File Systems