summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2015-04-13 17:05:44 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-06-08 02:44:08 -0700
commit3a82ea38fd5b150796e1f436097ad45a629835e7 (patch)
tree453693a21ec645de16fca03679cd8dd0eb52e512 /xlators
parent88d19dfd60fc705375abc8e739b50db111a65a48 (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 'xlators')
-rw-r--r--xlators/storage/posix/src/posix-helpers.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index ba42272065b..aaa9ac1ee29 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -1633,18 +1633,12 @@ __posix_fd_ctx_get (fd_t *fd, xlator_t *this, struct posix_fd **pfd_p)
goto out;
}
if (!fd_is_anonymous(fd)) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- P_MSG_READ_FAILED,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_READ_FAILED,
"Failed to get fd context for a non-anonymous fd, "
- "file: %s, gfid: %s", real_path,
- uuid_utoa (fd->inode->gfid));
+ "gfid: %s", uuid_utoa (fd->inode->gfid));
goto out;
}
- if (!fd_is_anonymous(fd))
- /* anonymous fd */
- goto out;
-
MAKE_HANDLE_PATH (real_path, this, fd->inode->gfid, NULL);
if (!real_path) {
gf_msg (this->name, GF_LOG_ERROR, 0,
@@ -1671,8 +1665,12 @@ __posix_fd_ctx_get (fd_t *fd, xlator_t *this, struct posix_fd **pfd_p)
_fd = dirfd (dir);
}
+ /* Using fd->flags in case we choose to have anonymous
+ * fds with different flags some day. As of today it
+ * would be GF_ANON_FD_FLAGS and nothing else.
+ */
if (fd->inode->ia_type == IA_IFREG) {
- _fd = open (real_path, O_RDWR|O_LARGEFILE);
+ _fd = open (real_path, fd->flags);
if (_fd == -1) {
POSIX_GET_FILE_UNLINK_PATH (priv->base_path,
fd->inode->gfid,