diff options
author | Raghavendra Talur <rtalur@redhat.com> | 2015-04-13 17:05:44 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-06-08 02:44:08 -0700 |
commit | 3a82ea38fd5b150796e1f436097ad45a629835e7 (patch) | |
tree | 453693a21ec645de16fca03679cd8dd0eb52e512 /libglusterfs/src | |
parent | 88d19dfd60fc705375abc8e739b50db111a65a48 (diff) |
libglusterfs: Even anonymous fds must have fd->flags set
Backport of: http://review.gluster.org/10219
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: I60d5b04ab851c31fbe4e5e74bee1af1b14daa52e
BUG: 1342903
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: http://review.gluster.org/14662
Tested-by: Krutika Dhananjay <kdhananj@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/fd.c | 4 | ||||
-rw-r--r-- | libglusterfs/src/fd.h | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 297d7036216..7d9a0cc1c5e 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -314,8 +314,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) { @@ -786,6 +785,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 412fcc5d6a4..2e93f76988a 100644 --- a/libglusterfs/src/fd.h +++ b/libglusterfs/src/fd.h @@ -25,6 +25,7 @@ #include "common-utils.h" #define GF_ANON_FD_NO -2 +#define GF_ANON_FD_FLAGS (O_RDWR|O_LARGEFILE) struct _inode; struct _dict; @@ -52,7 +53,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; |