unlock_buffer() and clear_bit()

From: Zoltan Menyhart <Zoltan.Menyhart_at_bull.net>
Date: 2006-03-25 02:18:11
I wonder if "unlock_buffer()" works correctly on ia64...

As far As I can see, nothing makes it sure that data modifications
issued inside the critical section be globally visible before the
"BH_Lock" bit gets cleared.

- Either an "smp_mb__before_clear_bit()" is lacking
  (if we want to keep the existing definition of "clear_bit()"
   with its "acq" semantics)

- or "clear_bit()" should use the "rel" semantics
  (since we are actually _releasing_ a lock)


Zoltan Menyhart


void fastcall unlock_buffer(struct buffer_head *bh)
	wake_up_bit(&bh->b_state, BH_Lock);


 * clear_bit() has "acquire" semantics.
#define smp_mb__before_clear_bit()	smp_mb()
#define smp_mb__after_clear_bit()	do { /* skip */; } while (0)

 * clear_bit - Clears a bit in memory
 * @nr: Bit to clear
 * @addr: Address to start counting from
 * clear_bit() is atomic and may not be reordered.  However, it does
 * not contain a memory barrier, so if it is used for locking purposes,
 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
 * in order to ensure changes are visible on other processors.

To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sat Mar 25 02:19:00 2006

This archive was generated by hypermail 2.1.8 : 2006-03-25 02:19:11 EST