summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/fd.c14
-rw-r--r--xlators/protocol/server/src/server-resolve.c5
2 files changed, 8 insertions, 11 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 7177fa275db..118f876c396 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -812,17 +812,11 @@ fd_anonymous_with_flags (inode_t *inode, int32_t flags)
LOCK (&inode->lock);
{
- if (flags == 0)
+ if (flags & O_DIRECT)
+ flags = GF_ANON_FD_FLAGS | O_DIRECT;
+ else
flags = GF_ANON_FD_FLAGS;
- /* If this API is ever called with O_SYNC or O_DSYNC in @flags,
- * reset the bits associated with these flags before calling
- * __fd_anonymous(). That way, posix will do the open() without
- * these flags. And subsequently, posix_writev() (mostly) will
- * do the write within inode->lock on an fd without O_SYNC or
- * O_DSYNC and in its place to an fsync() outside of the locks
- * to simulate the effect of using these flags.
- */
- flags &= (~(O_SYNC|O_DSYNC));
+
fd = __fd_anonymous (inode, flags);
}
UNLOCK (&inode->lock);
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index 3e1411250b8..1ad45394dd7 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -453,7 +453,10 @@ resolve_anonfd_simple (call_frame_t *frame)
ret = 0;
- state->fd = fd_anonymous_with_flags (inode, state->flags);
+ if (frame->root->op == GF_FOP_READ || frame->root->op == GF_FOP_WRITE)
+ state->fd = fd_anonymous_with_flags (inode, state->flags);
+ else
+ state->fd = fd_anonymous (inode);
out:
if (inode)
inode_unref (inode);