[Drbd-dev] DRBD-8: crashes if role is changed to Secondary whilst disk state is Negotiating...

Graham, Simon Simon.Graham at stratus.com
Sun Sep 24 17:35:44 CEST 2006


The specific crash I saw was due to this code in drbd_set_role; drbd_set_role calls drbd_al_to_on_disk_bm() if the new role is secondary and the disk state is not diskless -- there are transitory states between diskless and attached where this is not valid.

The specific lines of code are:

    if(mdev->state.disk > Diskless && (new_role & Secondary)) {
        drbd_al_to_on_disk_bm(mdev);
    }

and the test should presumably be 'mdev->state.disk > Negotiating' - however, this routine presumably needs to use inc_local() to do this so I would propose the following:

	if ((new_role & Secondary) && inc_local(mdev)) {
		drbd_al_to_on_disk_bm(mdev);

		dec_local(mdev);
	}

Simon


More information about the drbd-dev mailing list