All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org
Subject: Re: [PATCH 1/3] Make sockets proper objhash objects and use checkpoint_obj() on them (v2)
Date: Thu, 03 Sep 2009 07:03:08 -0700	[thread overview]
Message-ID: <87eiqoyvkz.fsf@caffeine.danplanet.com> (raw)
In-Reply-To: <20090903054058.GA7189-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> (Serge E. Hallyn's message of "Thu\, 3 Sep 2009 00\:40\:58 -0500")

SH> I'm sure I sound like an idiot, but... at restore, a socket will
SH> be created for sk now.  Is that a problem?  I don't see where
SH> sk_free() will cause that sock to be freed, and you are not
SH> attaching it do a file whose close would cause it to be
SH> released...

In the regular socket code, the reference that is taken during
allocation is assumed to be for the owning object (the file).  So,
they don't take another ref when they actually attach it to a file.

The objhash assumes that for all objects on restore, the allocation
routine for the object has already incremented the reference count for
it as the owner.  If you look at restore_obj() it drops the ref count
right after stuffing the object in the hash because the act of
insertion grabs a reference.  On checkpoint, this is the reference for
the hash.  On restore, it would be redundant because it is the first
owner (not a file, etc).

My code takes *another* reference when it attaches to a file, if
appropriate.  In the case of the adopted socket, only the objhash
holds a reference to it, so unless it was joined to a peer, it will be
freed when the objhash does its final obj_ref_drop() at tear-down
time.

-- 
Dan Smith
IBM Linux Technology Center
email: danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org

  parent reply	other threads:[~2009-09-03 14:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-02 18:22 [RFC] Sockets as proper objects and buffers with owners Dan Smith
     [not found] ` <1251915760-20118-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-02 18:22   ` [PATCH 1/3] Make sockets proper objhash objects and use checkpoint_obj() on them (v2) Dan Smith
     [not found]     ` <1251915760-20118-2-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-03  0:32       ` Oren Laadan
     [not found]         ` <4A9F0E96.70106-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-03 15:21           ` Dan Smith
2009-09-03  5:40       ` Serge E. Hallyn
     [not found]         ` <20090903054058.GA7189-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-03 14:03           ` Dan Smith [this message]
     [not found]             ` <87eiqoyvkz.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-09-03 14:43               ` Serge E. Hallyn
     [not found]                 ` <20090903144341.GA13182-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-03 15:08                   ` Dan Smith
2009-09-03 14:46               ` Oren Laadan
2009-09-02 18:22   ` [PATCH 2/3] Add post-file deferqueue Dan Smith
     [not found]     ` <1251915760-20118-3-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-03  0:04       ` Oren Laadan
     [not found]         ` <4A9F0804.7080704-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-03 15:19           ` Dan Smith
2009-09-02 18:22   ` [PATCH 3/3] [RFC] Track socket buffer owners Dan Smith
     [not found]     ` <1251915760-20118-4-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-03  1:52       ` Oren Laadan
     [not found]         ` <4A9F2158.4010405-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-09-03 15:24           ` Dan Smith
     [not found]             ` <87skf4xd9a.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org>
2009-09-03 15:46               ` Oren Laadan
  -- strict thread matches above, loose matches on Subject: below --
2009-09-09 15:05 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

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=87eiqoyvkz.fsf@caffeine.danplanet.com \
    --to=danms-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=serue-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.