+ if (req->cmd_flags & REQ_FLUSH) {
+ if (unlikely(blk_rq_sectors(req))) {
+ /* Elevator is meant to guarantee that a request with REQ_FLUSH
+ * set is broken into an empty request with REQ_FLUSH set then
+ * the rest of the content (if any). If this doesn't happen,
+ * whinge, then proceed to do the content without a flush.
+ */
+ printk(KERN_ERR "%s: nbd passed non-empty flush request\n",
+ lo->disk->disk_name);
+
+ } else {
+ if (lo->flags & NBD_FLAG_SEND_FLUSH)
+ nbd_cmd(req) = NBD_CMD_FLUSH;
+ else {
+ /* Ignore flush that we don't need */
+ nbd_end_request(req);
+ return;
+ }
+ }
+ }
+