Re: Closing enbd devices
[email protected] (Peter T. Breuer)
| Newsgroups | gmane.linux.enbd.general |
|---|---|
| Message-ID | <[email protected]> |
In article <[email protected]> you wrote: > I opted for editing the "reset" function, as it already clears (some of) > the state, and it seems unlikely that anyone would attempt to resurrect > a connection after resetting the device in this fashion. It just seemed > like the most natural choice. That's fine - thanks! > Patch attached. It has only had basic testing (it worked in my > particular test-case under a 2.4 kernel, 2.6-kernel completely > untested), but the change seems quite straightforward... I don't use "reset" so whatever you do there is OK with me :-). Be aware, however, that I somewhat doubt that reset can work as expected in many useful situations, because of all the race conditions associated with stopping a device. Perhaps I should introduce the state "stopped"? Maybe I could add the signature of the device to outgoing requests. Then if requests come back in bearing a signature that does not match, I could error them. That would kill quite a lot of races, no? Anyway, your addition certainly does not harm "reset"! Thanks. Just be aware of some of the difficulties associated with changing signature at all :-), or similar things. If you want to experiment separately, add another function like "reset", that only does the toggle of the SIGNED flag. > current purpose of reset?), I would like to propose renaming my new > reset function to "reuse" and have both. Well, that's OK too, but it's fairly harmless (I am trying to get you to do the testing and development here, since you have the interest and the use for this particular functionality, and I don't - apologies). > diff -Naur nbd-2.4.32/kernel/linux-2.4.x/drivers/block/enbd.c > nbd-2.4.32-unsign/kernel/linux-2.4.x/drivers/block/enbd.c > --- nbd-2.4.32/kernel/linux-2.4.x/drivers/block/enbd.c 2004-09-11 > 02:26:50.000000000 +0000 > +++ > nbd-2.4.32-unsign/kernel/linux-2.4.x/drivers/block/enbd.c 2004-12-06 > 11:22:19.000000000 +0000 > @@ -6159,6 +6159,7 @@ > } > atomic_clear_mask(ENBD_ENABLED, &lo->flags); > atomic_clear_mask(ENBD_VALIDATED, &lo->flags); > + atomic_clear_mask(ENBD_SIGNED, &lo->flags); > lo->nslot = 0; > write_unlock(&lo->meta_lock); > }; > diff -Naur nbd-2.4.32/kernel/linux-2.6.x/drivers/block/enbd/enbd_base.c > nbd-2.4.32-unsign/kernel/linux-2.6.x/drivers/block/enbd/enbd_base.c > --- > nbd-2.4.32/kernel/linux-2.6.x/drivers/block/enbd/enbd_base.c 2004-09-06 01:00:58.000000000 +0000 > +++ > nbd-2.4.32-unsign/kernel/linux-2.6.x/drivers/block/enbd/enbd_base.c 2004-12-06 11:21:54.000000000 +0000 > @@ -4864,6 +4864,7 @@ > } > atomic_clear_mask(ENBD_ENABLED, &lo->flags); > atomic_clear_mask(ENBD_VALIDATED, &lo->flags); > + atomic_clear_mask(ENBD_SIGNED, &lo->flags); > lo->nslot = 0; > write_unlock(&lo->meta_lock); > ENBD_ALERT("set INVALID on nd%s\n", lo->devnam);