$NetBSD: patch-bb,v 1.8 2011/09/18 01:36:06 manu Exp $

O_DIRECTORY is defined as 0, therefore ((flags & O_DIRECTORY) == O_DIRECTORY)
is always true even if the flag is not set.

--- xlators/performance/quick-read/src/quick-read.c.orig	2011-08-23 14:31:41.000000000 +0200
+++ xlators/performance/quick-read/src/quick-read.c	2011-10-02 02:55:29.000000000 +0200
@@ -82,8 +82,9 @@
 qr_loc_fill (loc_t *loc, inode_t *inode, char *path)
 {
         int32_t  ret    = -1;
         char    *parent = NULL;
+	char	*path_copy = NULL;
 
         GF_VALIDATE_OR_GOTO_WITH_ERROR ("quick-read", loc, out, errno, EINVAL);
         GF_VALIDATE_OR_GOTO_WITH_ERROR ("quick-read", inode, out, errno,
                                         EINVAL);
@@ -94,15 +95,15 @@
         loc->inode = inode_ref (inode);
         loc->path = gf_strdup (path);
         loc->ino = inode->ino;
 
-        parent = gf_strdup (path);
-        if (parent == NULL) {
+        path_copy = gf_strdup (path);
+        if (path_copy == NULL) {
                 ret = -1;
                 goto out;
         }
 
-        parent = dirname (parent);
+        parent = dirname (path_copy);
 
         loc->parent = inode_from_path (inode->table, parent);
         if (loc->parent == NULL) {
                 ret = -1;
@@ -118,10 +119,10 @@
         if (ret == -1) {
                 qr_loc_wipe (loc);
         }
 
-        if (parent) {
-                GF_FREE (parent);
+        if (path_copy) {
+                GF_FREE (path_copy);
         }
 
         return ret;
 }
@@ -729,9 +730,9 @@
                 }
         }
         UNLOCK (&table->lock);
 
-        if (content_cached && ((flags & O_DIRECTORY) == O_DIRECTORY)) {
+        if (content_cached && (flags & O_DIRECTORY)) {
                 op_ret = -1;
                 op_errno = ENOTDIR;
                 gf_log (this->name, GF_LOG_WARNING,
                         "open with O_DIRECTORY flag received on non-directory");
