Skip to contentSkip to conversation

ubifs: another scheduling while atomic back trace

DISCUSSION Cal Page 2 participants 2 messages Dec 18, 2008 Memory technology devices (MTD)

lore
Share & tools
lore

Cal Page

author
#0 lore raw

I tracked it down to fs/ubifs/journal.c in make_reservation()?

the code is:
again:
down_read()
err = reserve_space()
if ( !err) return 0
up_read()

shouldn't we to the up as part of the if? ie

   if ( !err ) { up_read(); return 0; };

Also, I notice fs/fs-writeback.c in writeback_inodes does a down_read_trylock. Won't this interfear with the down_read above?

Cal Page

#1 lore raw
Quoted 1 line · Cal Page

I tracked it down to fs/ubifs/journal.c in make_reservation()?

How did you track? And what pointed you to this function?

Quoted 6 lines

the code is:
again:
down_read()
err = reserve_space()
if ( !err) return 0
up_read()

That code really looks hacky, because it takes the lock and assumes the caller unlocks it. We tried to come up with a better solution, and debated on this, but concluded that this is the best way.

IOW, this is fine, because the caller unlocks the lock using 'finish_reservation()' call.

Moreover, rw semaphore should not make the code to be atomic.

Quoted 2 lines

Also, I notice fs/fs-writeback.c in writeback_inodes does a down_read_trylock. Won't this interfear with the down_read above?

Sorry, I do not see how and what should interfere there.

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)