2001-11-02 18:44:36

by Russ Weight

[permalink] [raw]
Subject: bdevname(), cdevname(), kdevname() - static buffers

Hi,

I was looking at the usage of bdevname(), cdevname(), and kdevname(),
and noticed that they each return a pointer to a static buffer.
This buffer contains a formatted device name, which is typically
printed immediately following the call. However, I don't see any
explicit lock protection for these buffers.

For SMP systems, is there something implicit in their use that
prevents a race on these buffers? Has anyone seen garbled device
names being printed (which might be attributed to a race)?

- Russ

----------------------------------------------------------------------

Russ Weight ([email protected])
IBM Technology Center


2001-11-02 19:05:38

by Alan

[permalink] [raw]
Subject: Re: bdevname(), cdevname(), kdevname() - static buffers

> I was looking at the usage of bdevname(), cdevname(), and kdevname(),
> and noticed that they each return a pointer to a static buffer.
> This buffer contains a formatted device name, which is typically
> printed immediately following the call. However, I don't see any
> explicit lock protection for these buffers.
>
> For SMP systems, is there something implicit in their use that
> prevents a race on these buffers? Has anyone seen garbled device
> names being printed (which might be attributed to a race)?

Not currently, other than statistics being on our side. It probably should
be touched up in 2.4 to use per cpu buffers and perhaps 2.5 pass a buffer
in

2001-11-02 19:09:36

by Andreas Dilger

[permalink] [raw]
Subject: Re: bdevname(), cdevname(), kdevname() - static buffers

On Nov 02, 2001 10:42 -0800, Russ Weight wrote:
> I was looking at the usage of bdevname(), cdevname(), and kdevname(),
> and noticed that they each return a pointer to a static buffer.
> This buffer contains a formatted device name, which is typically
> printed immediately following the call. However, I don't see any
> explicit lock protection for these buffers.
>
> For SMP systems, is there something implicit in their use that
> prevents a race on these buffers? Has anyone seen garbled device
> names being printed (which might be attributed to a race)?

I think the general usage of these is only for informational needs, so
if there is a rare race it is not worth fixing.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/