From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org
Subject: Re: [PATCH 3/3] Track socket buffer owners (v2)
Date: Thu, 10 Sep 2009 21:02:06 -0500 [thread overview]
Message-ID: <20090911020206.GA15845@us.ibm.com> (raw)
In-Reply-To: <1252508756-4278-4-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Quoting Dan Smith (danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
> This patch is a superset of the previous attempt to store socket buffers
> with their owners. It defers the writing and reading of the socket buffers
> until after the end of the file phase to avoid a recursive nose-dive of
> checkpointing socket owners.
>
> This also moves the join logic to the deferqueue as well, since that too
> can lead us down a deep hole. The buffer restore logic may perform a join
> if it decides that the join is inevitable (but not yet performed) and
> necessary.
>
> Changes in v2:
> - Add comment about using deferqueue_add() in a function that could have
> been called during deferqueue_run()
> - Change 'ref' to 'objref' in several variable names
> - Move SOCK_DEAD flag detection to initial patch
> - Catch errors from unix_read_buffers(), even on the should-be-missing
> send buffers
>
> Signed-off-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Looks fine to my unqualified eyes, except for:
> @@ -139,54 +241,125 @@ static int sock_read_buffer_sendmsg(struct ckpt_ctx *ctx, struct sock *sk)
> if (ret < 0)
> goto out;
>
> + msg.msg_name = addr;
> + msg.msg_namelen = addrlen;
> +
> + /* If peer is shutdown, unshutdown it for this process */
> + sock_shutdown = sk->sk_shutdown;
> + sk->sk_shutdown &= ~SHUTDOWN_MASK;
> +
> + /* Unshutdown peer too, if necessary */
> + if (unix_sk(sk)->peer) {
> + peer_shutdown = unix_sk(sk)->peer->sk_shutdown;
> + unix_sk(sk)->peer->sk_shutdown &= ~SHUTDOWN_MASK;
> + }
> +
> + /* Make sure there's room in the send buffer */
> + sndbuf = sk->sk_sndbuf;
> + if (capable(CAP_NET_ADMIN) &&
> + ((sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc)) < len))
'capable' actually has an adverse effect of setting the PF_SUPERPRIV
flag on current. So if I don't misread this, you'll want to do the
length check first, then the capable check, in order to make sure
that PF_SUPERPRIV doesn't get set unless the privilege was actually
needed.
> + sk->sk_sndbuf += len;
> + else
> + sk->sk_sndbuf = sysctl_wmem_max;
-serge
next prev parent reply other threads:[~2009-09-11 2:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 15:05 Track socket buffer owners Dan Smith
[not found] ` <1252508756-4278-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-09 15:05 ` [PATCH 1/3] Make sockets proper objhash objects and use checkpoint_obj() on them (v2) Dan Smith
[not found] ` <1252508756-4278-2-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-09 23:02 ` Oren Laadan
[not found] ` <4AA833F5.3040706-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-11 14:31 ` Dan Smith
[not found] ` <87d45xlfhz.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-09-11 19:46 ` Oren Laadan
2009-09-09 15:05 ` [PATCH 2/3] Add post-file deferqueue (v2) Dan Smith
[not found] ` <1252508756-4278-3-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-09 22:32 ` Oren Laadan
[not found] ` <4AA82D13.6040008-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-11 14:23 ` Dan Smith
[not found] ` <87hbv9lfup.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-09-11 19:43 ` Oren Laadan
2009-09-14 15:04 ` Oren Laadan
2009-09-09 15:05 ` [PATCH 3/3] Track socket buffer owners (v2) Dan Smith
[not found] ` <1252508756-4278-4-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-11 2:02 ` Serge E. Hallyn [this message]
[not found] ` <20090911020206.GA15845-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-11 14:31 ` Dan Smith
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=20090911020206.GA15845@us.ibm.com \
--to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
/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.