summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/fd.c
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2012-11-12 09:58:02 -0500
committerVijay Bellur <vbellur@redhat.com>2013-07-05 06:31:14 -0700
commit34bca063cd8e7721c876e0f06d42978d5ff4d835 (patch)
tree2cfb6cddec1bbec1f3b7d8b35807a9bd1fa40a75 /libglusterfs/src/fd.c
parent3521020078e822d74eed235074dc978981fb56ed (diff)
NFS is picking up geo-rep's already open (read-only) file descriptorv3.3.2qa4v3.3.2
Add anonymous member to fd_t and use it instead of over-loading pid for geo-rep and self heal Change-Id: I4d6b29a044a8ed4b8f69ff6e3f35ee227739b2af Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> BUG: 874272 Reviewed-on: http://review.gluster.org/4185 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/5283
Diffstat (limited to 'libglusterfs/src/fd.c')
-rw-r--r--libglusterfs/src/fd.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index b0b75a5..5ef4c04 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -121,7 +121,7 @@ gf_fd_fdtable_alloc (void)
}
-fdentry_t *
+static fdentry_t *
__gf_fd_fdtable_get_all_fds (fdtable_t *fdtable, uint32_t *count)
{
fdentry_t *fdentries = NULL;
@@ -159,7 +159,7 @@ gf_fd_fdtable_get_all_fds (fdtable_t *fdtable, uint32_t *count)
}
-fdentry_t *
+static fdentry_t *
__gf_fd_fdtable_copy_all_fds (fdtable_t *fdtable, uint32_t *count)
{
fdentry_t *fdentries = NULL;
@@ -707,24 +707,44 @@ fd_lookup_uint64 (inode_t *inode, uint64_t pid)
return fd;
}
+static fd_t *
+__fd_lookup_anonymous (inode_t *inode)
+{
+ fd_t *iter_fd = NULL;
+ fd_t *fd = NULL;
+
+ if (list_empty (&inode->fd_list))
+ return NULL;
-fd_t *
+ list_for_each_entry (iter_fd, &inode->fd_list, inode_list) {
+ if (iter_fd->anonymous) {
+ fd = __fd_ref (iter_fd);
+ break;
+ }
+ }
+
+ return fd;
+}
+
+static fd_t *
__fd_anonymous (inode_t *inode)
{
fd_t *fd = NULL;
- fd = __fd_lookup (inode, (uint64_t)-1);
+ fd = __fd_lookup_anonymous (inode);
/* if (fd); then we already have increased the refcount in
- __fd_lookup(), so no need of one more fd_ref().
+ __fd_lookup_anonymous(), so no need of one more fd_ref().
if (!fd); then both create and bind wont bump up the ref
count, so we have to call fd_ref() after bind. */
if (!fd) {
- fd = __fd_create (inode, (uint64_t)-1);
+ fd = __fd_create (inode, 0);
if (!fd)
return NULL;
+ fd->anonymous = _gf_true;
+
__fd_bind (fd);
__fd_ref (fd);
@@ -752,7 +772,7 @@ fd_anonymous (inode_t *inode)
gf_boolean_t
fd_is_anonymous (fd_t *fd)
{
- return (fd && fd->pid == -1);
+ return (fd && fd->anonymous);
}
@@ -900,7 +920,7 @@ fd_ctx_get (fd_t *fd, xlator_t *xlator, uint64_t *value)
}
-int
+static int
__fd_ctx_del (fd_t *fd, xlator_t *xlator, uint64_t *value)
{
int index = 0;