Re: Re: Closing enbd devices
Dag Sverre Seljebotn <[email protected]>
| Newsgroups | gmane.linux.enbd.general |
|---|---|
| Message-ID | <[email protected]> |
(Sorry if this is a repost, I think the mailing list ate my first one
(with an attachment patch instead of inline))
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.
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...
If you do not want to accept it for one reason or another (breaking the
current purpose of reset?), I would like to propose renaming my new
reset function to "reuse" and have both.
// Dag Sverre
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);