Re: 2.4.11-pre2 fs/buffer.c: invalidate: busy buffer

Alexander Viro
2001-10-03T04:21:04Z

On Wed, 3 Oct 2001, Linus Torvalds wrote:

> It's harmless, although I hope that the LVM people will become a bit
> less invalidation-happy as a result of the warning (it's always happened
> before, it just hasn't warned about it in earlier kernels).

AFAICS, md.c also doesn't play nice with buffe cache.

fsync_dev(dev);
set_blocksize(dev, MD_SB_BYTES);
bh = getblk(dev, sb_offset / MD_SB_BLOCKS, MD_SB_BYTES);
if (!bh) {
printk(GETBLK_FAILED, partition_name(dev));
return 1;
}
memset(bh->b_data,0,bh->b_size);
sb = (mdp_super_t *) bh->b_data;
memcpy(sb, rdev->sb, MD_SB_BYTES);

mark_buffer_uptodate(bh, 1);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
fsync_dev(dev);

is not a good thing to do (write_disk_sb()). Not to mention the fact that
set_blocksize() looks bogus, the code is obviously racy. Think what will
happen if somebody is reading from device at that moment.