[sheepdog] `tid_max` in lib/work.c need to be initialized
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Wed Oct 29 03:52:55 CET 2014
At Tue, 28 Oct 2014 17:52:04 +0800,
Jinzhi Chen wrote:
>
> [1 <multipart/alternative (7bit)>]
> [1.1 <text/plain; UTF-8 (7bit)>]
> sorry, i'thinks `tid_max` should be set to 1,
Hi Jinzhi,
Thanks for your report. It seems to be reasonable. Current tracing
subsystem has a problem as you say. tid_max should be set to 1 and
tid_map should have bitmap area for it as soon as possible in the
initialization process of sheep. In addition, sd_thread_create() must
update tid_max.
Seems that you understand the problem well, could you prepare a patch
for it if you have time? Or could you add an issue to our launchpad
bugtracker?
Thanks,
Hitoshi
>
> On Tue, Oct 28, 2014 at 5:29 PM, Jinzhi Chen <nxtjinzhi at gmail.com> wrote:
>
> > hi,
> >
> > I'm currently using sheepodg v0.8.3, configure with --enable-debug & start
> > sheep with journal directory.
> >
> >
> > during `journal_file_init` progress, journal thread is created.
> > but the `tid_max` is not initialized until `wq_trace_init` is called,
> > which is called just after journal init progress.
> > Thus the journal thread enter into infinite loop when trace is enabled.
> > (below is related code)
> >
> >
> > static void trace_set_tid_map(int tid)
> > {
> > sd_mutex_lock(&tid_map_lock);
> > if (tid > tid_max) {
> > size_t old_tid_max = tid_max;
> >
> > /* enlarge bitmap size */
> > ## because tid_max is not initialized (which is 0), the
> > journal thread enter into loop
> > while (tid > tid_max)
> > tid_max *= 2;
> >
> > tid_map = alloc_bitmap(tid_map, old_tid_max, tid_max);
> > }
> > set_bit(tid, tid_map);
> > sd_mutex_unlock(&tid_map_lock);
> > }
> >
> > I think `tid_max` should be initialized to TID_MAX_DEFAULT in to avoid
> > issue.
> > thus, change lib/work.c
> >
> > -static size_t tid_max;
> > +static size_t tid_max = TID_MAX_DEFAULT
> >
> > & delete related code in wq_trace_init
> >
> > Correct me if I'm wrong.
> >
> >
> > Thanks
> >
> [1.2 <text/html; UTF-8 (quoted-printable)>]
>
> [2 <text/plain; us-ascii (7bit)>]
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog
More information about the sheepdog
mailing list