From: Wei Liu <wei.liu2@citrix.com>
To: David Scott <dave@recoil.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH for-4.8] tools/oxenstored: Avoid allocating invalid transaction ids
Date: Wed, 26 Oct 2016 13:02:19 +0100 [thread overview]
Message-ID: <20161026120219.GK30231@citrix.com> (raw)
In-Reply-To: <3CAFB439-EBE4-46C1-A07F-71A48ABEBCBE@recoil.org>
On Wed, Oct 26, 2016 at 10:46:17AM +0100, David Scott wrote:
>
> > On 26 Oct 2016, at 10:34, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
> >
> > The transaction id of 0 is reserved, meaning "not in a transaction". It is up
> > to the xenstored server to allocate transaction ids. While oxenstored starts
> > its ids at 1, but insufficient care is taken with truncation cases.
> >
> > A 32bit oxenstored has an int with 31 bits of width, meaning that the
> > transaction id will wrap around to 0 after 2 billion transactions.
> >
> > A 64bit oxenstored has an int with 63 bits of width, meaning that once 4
> > billion transactions are used, the allocated id will be truncated when written
> > into the uin32_t field in the ring. This causes the client to reply with the
> > truncated id, breaking any further attempt to use any transactions.
> >
> > Limit all transaction ids to the range between 1 and 0x7ffffffe. This is the
> > best which can be done without making oxenstored depend on Stdint or Cstruct,
> > yet still work for 32bit builds.
>
> Good catch, looks good to me!
>
> >
> > Also check that the proposed new transaction id isn't currently in use. For
> > the first 2 billion transactions there is no chance of a collision, and after
> > that, the chance is at most 20 (the default open transaction quota) in 2
> > billion.
>
> That makes sense to me. There seems little chance of the hash table filling up when the quota is set to 20 :-)
>
> Acked-by: David Scott <dave@recoil.org>
>
Thanks for the quick turnaround.
Applied.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-10-26 12:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 9:34 [PATCH for-4.8] tools/oxenstored: Avoid allocating invalid transaction ids Andrew Cooper
2016-10-26 9:46 ` David Scott
2016-10-26 12:02 ` Wei Liu [this message]
2016-10-26 12:05 ` Andrew Cooper
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=20161026120219.GK30231@citrix.com \
--to=wei.liu2@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dave@recoil.org \
--cc=xen-devel@lists.xen.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.