From 175f1737fb6fe9450702556b24bf395bac97cef1 Mon Sep 17 00:00:00 2001 From: Raghavendra Talur Date: Mon, 13 Apr 2015 17:05:44 +0530 Subject: libglusterfs: Even anonymous fds must have fd->flags set We do not set the same flags to anonymous fd that posix uses to open an anonymous fd in the backend. If there are any xlators which rely on these flags for their operation they may not work well. Add proper flags to anonymous fds at the time of their creation and refer to them for subsequent operations. Change-Id: Ia99b7ea7d38839f099c7b4aae3c7ead123bc8c67 BUG: 1211221 Signed-off-by: Raghavendra Talur Reviewed-on: http://review.gluster.org/10219 Tested-by: NetBSD Build System Reviewed-by: soumya k Reviewed-by: Poornima G Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Niels de Vos Reviewed-by: Raghavendra Bhat Reviewed-by: Raghavendra G --- libglusterfs/src/fd.c | 4 ++-- libglusterfs/src/fd.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'libglusterfs/src') diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 7377b1e30bd..688357327c0 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -309,8 +309,7 @@ gf_fd_put (fdtable_t *fdtable, int32_t fd) fd_t *fdptr = NULL; fdentry_t *fde = NULL; - if (fd == -2) - /* anonymous fd */ + if (fd == GF_ANON_FD_NO) return; if (fdtable == NULL || fd < 0) { @@ -774,6 +773,7 @@ __fd_anonymous (inode_t *inode) return NULL; fd->anonymous = _gf_true; + fd->flags = GF_ANON_FD_FLAGS; __fd_bind (fd); diff --git a/libglusterfs/src/fd.h b/libglusterfs/src/fd.h index 5a98ec38ca7..53ec93dec6c 100644 --- a/libglusterfs/src/fd.h +++ b/libglusterfs/src/fd.h @@ -20,6 +20,7 @@ #include "common-utils.h" #define GF_ANON_FD_NO -2 +#define GF_ANON_FD_FLAGS (O_RDWR|O_LARGEFILE) struct _inode; struct _dict; @@ -47,7 +48,9 @@ struct _fd { struct _fd_ctx *_ctx; int xl_count; /* Number of xl referred in this fd */ struct fd_lk_ctx *lk_ctx; - gf_boolean_t anonymous; /* geo-rep anonymous fd */ + gf_boolean_t anonymous; /* fd which does not have counterpart open + fd on backend (server for client, posix + for server). */ }; typedef struct _fd fd_t; -- cgit