From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [DLM PATCH] DLM: save / restore all socket callbacks
Date: Tue, 26 Jan 2016 20:04:24 +0000 [thread overview]
Message-ID: <56A7D148.9080309@redhat.com> (raw)
In-Reply-To: <1244929267.15846120.1453831061604.JavaMail.zimbra@redhat.com>
Hi,
On 26/01/16 17:57, Bob Peterson wrote:
> Hi,
>
> Before this patch, DLM was saving off the original error report
> callback before setting its own, but it never restored it. Instead,
> we should be saving off all four socket callbacks before changing
> them, and then restore them once we're done.
>
> Regards,
>
> Bob Peterson
> Red Hat File Systems
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
> index dc9ae6d..f9eb366 100644
> --- a/fs/dlm/lowcomms.c
> +++ b/fs/dlm/lowcomms.c
> @@ -124,7 +124,10 @@ struct connection {
> struct connection *othercon;
> struct work_struct rwork; /* Receive workqueue */
> struct work_struct swork; /* Send workqueue */
> - void (*orig_error_report)(struct sock *sk);
> + void (*orig_error_report)(struct sock *);
> + void (*orig_data_ready)(struct sock *);
> + void (*orig_state_change)(struct sock *);
> + void (*orig_write_space)(struct sock *);
> };
> #define sock2con(x) ((struct connection *)(x)->sk_user_data)
>
> @@ -465,12 +468,43 @@ int dlm_lowcomms_connect_node(int nodeid)
> return 0;
> }
>
> -static void lowcomms_error_report(struct sock *sk)
> +static void save_old_callbacks(struct sock *sk)
> +{
> + struct connection *con = sock2con(sk);
> +
> + if (sk->sk_error_report) {
> + 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;
> + }
> +}
> +
This should not need to be conditional, because sk->sk_error_report()
should never be NULL, so I think that needs looking at again - where did
that NULL pointer come from?
Also the other callbacks, data_ready, etc should also have the same
locking pattern of read_lock_bh(), con = sock2con(sk); if (con) { /*
original code here */ } read_unlock_bh(); as per the error_report one,
Steve.
prev parent reply other threads:[~2016-01-26 20:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2116520443.15845809.1453831014524.JavaMail.zimbra@redhat.com>
2016-01-26 17:57 ` [Cluster-devel] [DLM PATCH] DLM: save / restore all socket callbacks Bob Peterson
2016-01-26 20:04 ` Steven Whitehouse [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56A7D148.9080309@redhat.com \
--to=swhiteho@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.