[CRIU] [PATCH v4 08/15] unix: Dump DGRAM packets and sockets senders
Kirill Tkhai
ktkhai at virtuozzo.com
Thu Jun 9 06:28:54 PDT 2016
On 09.06.2016 16:10, Pavel Emelyanov wrote:
> On 06/01/2016 07:02 PM, Kirill Tkhai wrote:
>> Add a method to get a DGRAM packet sender. This allows dump_sk_queue()
>> to dump its inode. If there is the only sender for whole socket's packets,
>> dump its inode at UnixSkEntry::sender_ino.
>>
>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>> ---
>> criu/sk-unix.c | 20 ++++++++++++++++++--
>> 1 file changed, 18 insertions(+), 2 deletions(-)
>>
>> diff --git a/criu/sk-unix.c b/criu/sk-unix.c
>> index 9db911b..4bda078 100644
>> --- a/criu/sk-unix.c
>> +++ b/criu/sk-unix.c
>> @@ -133,6 +133,16 @@ static struct unix_sk_desc *find_unix_sk_by_name(const char *name, int namelen)
>> return NULL;
>> }
>>
>> +static u64 find_unix_dgram_ino_by_name(const char *name, int namelen)
>> +{
>> + struct unix_sk_desc *sk = find_unix_sk_by_name(name, namelen);
>> +
>> + if (sk && sk->type != SOCK_DGRAM)
>
> How can this happen?
DGRAM socket had died, before its STREAM namesake was created. So, DGRAM
packets has msg_name of died socket.
>> + sk = NULL;
>> +
>> + return sk ? sk->sd.ino : SK_NONAME_SENDER;
>> +}
>> +
>> static void show_one_unix(char *act, const struct unix_sk_desc *sk)
>> {
>> pr_debug("\t%s: ino %#x peer_ino %#x family %4d type %4d state %2d name %s\n",
>> @@ -462,9 +472,15 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p)
>> * (i stands for in-flight, cons -- for connections) things.
>> */
>> if (sk->rqlen != 0 && !(sk->type == SOCK_STREAM &&
>> - sk->state == TCP_LISTEN))
>> - if (dump_sk_queue(lfd, id, NULL))
>> + sk->state == TCP_LISTEN)) {
>> + u64 (*f)(const char *, int) = NULL;
>> +
>> + if (sk->type == SOCK_DGRAM)
>> + f = find_unix_dgram_ino_by_name;
>> + if (dump_sk_queue(lfd, id, f))
>> goto err;
>> + } else if (sk->rqlen == 0)
>> + ue->uflags |= USK_EMPTY_Q;
>
> Don't add this bit into ui image. Emptiness of the queue should be
> determined restore-time by collecting sk-packet image.
>
>>
>> pr_info("Dumping unix socket at %d\n", p->fd);
>> show_one_unix("Dumping", sk);
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
>> .
>>
>
More information about the CRIU
mailing list