[sheepdog] `tid_max` in lib/work.c need to be initialized

Jinzhi Chen nxtjinzhi at gmail.com
Tue Oct 28 10:52:04 CET 2014


sorry, i'thinks `tid_max` should be set to 1,

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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20141028/569011db/attachment-0004.html>


More information about the sheepdog mailing list