tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Locking in disk(9) api



Hi folks,

Yesterday tron@ submitted PR kern/42532 it's about panic which happen on 
device-mapper devices during concurrent access to them. After some 
investigation and help from others I have found that problem is that disk_busy 
and disk_unbusy requires users to manage locking for them. This problem wasn't 
found yet mostly because we don't have many D_MPSAFE enabled disk drivers and 
because dm is very specific in locking. 

After some discussion I think that disk(9) api should be changed to manage 
locking by itself and to not require explicit locking from users. There are 
some options which can be used in this case,]

1) Use diskp->dk_openlock to lock access to 
iostat_busy/iostat_unbusy/iostat_isbusy
2) Use atomic operations in iostat_busy/iostat_unbusy/iostat_isbusy to manage 
io_stat reference counter
3) Add mutex to struct io_stat and use it to guard io_stat entries from 
concurrent manipulation. There are 4 functions which will need to acquire this 
lock iostat_busy/iostat_unbusy/iostat_isbusy/iostat_seek and iostat_free

Any other suggestions ?

Regards

Adam.



Home | Main Index | Thread Index | Old Index