[PATCH] 2.2.14 make_request SMP safe?

From: Roger Larsson (roger.larsson@norran.net)
Date: Thu Apr 13 2000 - 16:52:40 EST


>From linux/drivers/block/ll_rw_blk.c:411

void make_request(int major, int rw, struct buffer_head * bh)
{
        unsigned int sector, count;
        struct request * req;
        int rw_ahead, max_req, max_sectors, max_segments;
        unsigned long flags;

        count = bh->b_size >> 9;
        sector = bh->b_rsector;

        /* Uhhuh.. Nasty dead-lock possible here.. */
        /* return if it could not be locked (already locked!), cheaper and SMP
safe! */
        if (test_and_set_bit(BH_Lock, &bh->b_state)) // if
(!try_lock_buffer(bh))
                return;

The earlier fix was a split test

        if (buffer_locked(bh))
                return;
        /* Maybe the above fixes it, and maybe it doesn't boot. Life is
interesting */

        lock_buffer(bh);

But since interrupts are not disabled (IMHO) and no other locks are held
(IMHO)
there is a small (and rather unlikely) window for a dead-lock...

Or am I mistaken again...

/RogerL

--
Home page:
  http://www.norran.net/nra02596/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:23 EST