Alex Bligh
75f187aba5
nbd: support FLUSH requests
...
Currently, the NBD device does not accept flush requests from the Linux
block layer. If the NBD server opened the target with neither O_SYNC nor
O_DSYNC, however, the device will be effectively backed by a writeback
cache. Without issuing flushes properly, operation of the NBD device will
not be safe against power losses.
The NBD protocol has support for both a cache flush command and a FUA
command flag; the server will also pass a flag to note its support for
these features. This patch adds support for the cache flush command and
flag. In the kernel, we receive the flags via the NBD_SET_FLAGS ioctl,
and map NBD_FLAG_SEND_FLUSH to the argument of blk_queue_flush. When the
flag is active the block layer will send REQ_FLUSH requests, which we
translate to NBD_CMD_FLUSH commands.
FUA support is not included in this patch because all free software
servers implement it with a full fdatasync; thus it has no advantage over
supporting flush only. Because I [Paolo] cannot really benchmark it in a
realistic scenario, I cannot tell if it is a good idea or not. It is also
not clear if it is valid for an NBD server to support FUA but not flush.
The Linux block layer gives a warning for this combination, the NBD
protocol documentation says nothing about it.
The patch also fixes a small problem in the handling of flags: nbd->flags
must be cleared at the end of NBD_DO_IT, but the driver was not doing
that. The bug manifests itself as follows. Suppose you two different
client/server pairs to start the NBD device. Suppose also that the first
client supports NBD_SET_FLAGS, and the first server sends
NBD_FLAG_SEND_FLUSH; the second pair instead does neither of these two
things. Before this patch, the second invocation of NBD_DO_IT will use a
stale value of nbd->flags, and the second server will issue an error every
time it receives an NBD_CMD_FLUSH command.
This bug is pre-existing, but it becomes much more important after this
patch; flush failures make the device pretty much unusable, unlike
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Signed-off-by: Alex Bligh <alex@alex.org.uk >
Acked-by: Paul Clements <Paul.Clements@steeleye.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2013-02-27 19:10:22 -08:00
..
2012-10-13 10:46:49 +01:00
2012-10-09 09:48:40 +01:00
2013-01-26 16:59:02 +01:00
2013-01-23 19:06:33 -02:00
2012-11-09 16:28:37 -05:00
2012-10-09 09:48:44 +01:00
2012-10-09 09:48:45 +01:00
2012-10-11 17:27:54 -04:00
2013-02-05 01:49:26 +01:00
2012-10-09 09:48:56 +01:00
2012-10-09 09:48:58 +01:00
2012-10-09 09:48:59 +01:00
2012-11-02 12:26:32 +01:00
2012-10-09 09:49:02 +01:00
2012-10-09 09:49:02 +01:00
2012-10-09 09:49:03 +01:00
2012-10-09 09:49:04 +01:00
2012-10-09 09:49:05 +01:00
2012-10-09 09:49:06 +01:00
2013-02-21 13:55:12 +01:00
2012-10-09 09:49:08 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-01-11 14:54:56 -08:00
2012-10-13 10:46:48 +01:00
2013-02-08 20:42:18 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-01-21 15:40:35 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-21 20:23:36 +00:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-16 18:49:15 -07:00
2013-02-21 17:22:20 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-13 12:58:11 -05:00
2012-11-09 06:41:46 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-31 14:00:15 -04:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-21 17:22:20 -08:00
2012-10-13 10:46:48 +01:00
2013-02-07 14:25:44 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-11-19 22:21:03 +00:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-14 00:54:17 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-10 20:37:22 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-28 15:24:18 -08:00
2012-10-13 10:46:48 +01:00
2012-11-07 18:54:30 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-03 15:07:36 -05:00
2012-11-20 13:43:28 -05:00
2013-02-10 20:37:22 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-01-21 13:55:14 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-23 14:57:52 -04:00
2012-10-13 10:46:48 +01:00
2012-11-15 10:13:52 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-27 19:10:21 -08:00
2012-10-13 10:46:48 +01:00
2012-11-16 01:47:40 -05:00
2013-01-13 20:17:14 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-17 12:31:15 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-12 18:07:07 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-24 13:07:18 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-20 13:54:52 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-11 14:42:48 +00:00
2013-02-05 18:23:47 -02:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-14 13:05:23 +10:30
2012-10-13 10:46:48 +01:00
2013-01-21 13:55:14 -05:00
2013-01-21 13:55:14 -05:00
2013-02-27 19:10:11 -08:00
2013-01-04 16:11:45 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-27 19:10:22 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-13 19:42:16 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-04 13:08:10 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-01-14 12:28:54 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-15 09:41:44 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-11-16 10:15:35 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-26 10:39:23 -07:00
2012-10-13 10:46:48 +01:00
2013-01-24 16:40:19 -03:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-11-01 11:41:34 -04:00
2012-12-17 17:15:22 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-13 19:41:46 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-04 15:05:04 -08:00
2012-11-21 16:26:35 -08:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-19 18:07:39 -05:00
2012-10-13 10:46:48 +01:00
2013-01-07 11:18:58 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-06 01:22:31 +00:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-13 13:22:15 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-01-03 10:38:24 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-23 14:57:52 -04:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-05 18:23:47 -02:00
2012-10-13 10:46:48 +01:00
2012-12-21 12:11:11 -02:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-18 10:11:13 -07:00
2012-10-13 10:46:48 +01:00
2013-02-05 18:00:00 -02:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-12-18 15:20:44 +10:30
2013-01-21 14:07:44 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-18 15:02:51 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-01-31 19:56:35 -05:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2012-10-13 10:46:48 +01:00
2013-02-27 19:10:10 -08:00
2012-10-13 10:46:48 +01:00