Re: move block #A to block #B on a given device.

Stephen C. Tweedie (sct@redhat.com)
Mon, 8 Nov 1999 12:02:34 +0000 (GMT)


Hi,

On Thu, 4 Nov 1999 17:08:46 +0000 (GMT), Tigran Aivazian
<tigran@sco.COM> said:

> bh = bread(dev, A, 512);
> if (!bh)
> goto out;
> new = getblk(dev, B, 512);
> memcpy(new->b_data, bh->b_data, bh->b_size);
> mark_buffer_dirty(new, 1);
> out:
> brelse(bh);
> brelse(new);

After the
new = getblk()

you need to do a
if (!buffer_uptodate(new))
wait_on_buffer(new);

to address a race Andrea spotted recently in several other places in the
kernel.

--Stephen

-
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/