From 444cd5429cc00f3a4ddb5cde4b8b1c974b886e19 Mon Sep 17 00:00:00 2001
From: John Griffith <john.griffith@solidfire.com>
Date: Tue, 27 Nov 2012 05:46:58 +0000
Subject: [PATCH] Revert "use O_DIRECT when copying from /dev/zero too"

It turns out running oflag=direct against the LVM snapshot fails for an IO error every time.  Works fine against the regular volume, but fails on snapshot.

This reverts commit 1405a6440d646524d41adfed4fc1344948e2871f
---
 cinder/volume/driver.py | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py
index 0dacacfcd..35af09935 100644
--- a/cinder/volume/driver.py
+++ b/cinder/volume/driver.py
@@ -22,7 +22,6 @@ Drivers for volumes.
 
 import os
 import re
-import stat
 import time
 
 from cinder import exception
@@ -106,15 +105,7 @@ class VolumeDriver(object):
 
     def _copy_volume(self, srcstr, deststr, size_in_g):
         # Use O_DIRECT to avoid thrashing the system buffer cache
-        direct_flags = ['oflag=direct']
-        try:
-            # Avoid trying O_DIRECT on virtual inputs like /dev/zero
-            # as it's not supported with such devices.
-            if not stat.S_ISCHR(os.stat(srcstr).st_mode):
-                direct_flags += ['iflag=direct']
-        except OSError:
-            # Deal with any access issues below
-            pass
+        direct_flags = ('iflag=direct', 'oflag=direct')
 
         # Check whether O_DIRECT is supported
         try:
-- 
2.45.2