lkml.org 
[lkml]   [2006]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 11/17] fuse: add number of waiting requests attribute
Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> + /** The number of requests waiting for completion */
> + atomic_t num_waiting;

This doesn't get initialised anywhere.

Presumably you're relying on a memset somewhere. That might work on all
architectures, AFAIK. But in theory it's wrong. If, for example, the
architecture implements atomic_t via a spinlock-plus-integer, and that
spinlock's unlocked state is not all-bits-zero, we're dead.

So we should initialise it with

foo->num_waiting = ATOMIC_INIT(0);



nb: it is not correct to initialise an atomic_t with

atomic_set(a, 0);

because in the above theoretical case case where the arch uses a spinlock
in the atomic_t, that spinlock doesn't get initialised. I bet we've got code
in there which does this.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-01-14 02:29    [W:0.088 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site