Skip to contentSkip to conversation

Test12 ll_rw_block error.

DISCUSSION Russell Cattelan 2 participants 2 messages Dec 15, 2000

lore
Share & tools
lore
#0 lore raw

This would seem to be an error on the part of ll_rw_block. Setting b_end_io to a default handler without checking to see a callback has already been defined defeats the purpose of having a function op.

void ll_rw_block(int rw, int nr, struct buffer_head * bhs[])
{
@@ -928,7 +1046,8 @@

                if (test_and_set_bit(BH_Lock, &bh->b_state))
                        continue;
-               set_bit(BH_Req, &bh->b_state);
+               /* We have the buffer lock */
+               bh->b_end_io = end_buffer_io_sync;
                switch(rw) {
                case WRITE:

-Russell Cattelan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw

In article <[email protected]>,

Quoted 4 lines · Russell Cattelan

This would seem to be an error on the part of ll_rw_block. Setting b_end_io to a default handler without checking to see a callback has already been defined defeats the purpose of having a function op.

No.

It just means that if you have your own function op, you had better not call "ll_rw_block()".

The problem is that as it was done before, people would set the function op without actually holding the buffer lock.

Which meant that you could have two unrelated users setting the function op to two different things, and it would be only a matter of the purest luck which one happened to "win".

If you want to set your own end-operation, you now need to lock the buffer _first_, then set "b_end_io" to your operation, and then do a "submit_bh()". You cannot use ll_rw_block().

Yes, this is different than before. Sorry about that.

But yes, this way actually happens to work reliably.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/