diff options
authorXavier Hernandez <>2016-06-09 17:29:26 +0200
committerPranith Kumar Karampuri <>2016-06-13 18:03:50 -0700
commit8383a5163d0b97105e600e9361d322882023295f (patch)
parent2b984e60b97971f1cd2e661081efee3c4a387bcc (diff)
cluster/ec: Fix invalid __fd_unref() call
__fd_unref() doesn't do any cleanup, so it cannot be called to release fd references, specially if it's the last reference. The code has been changed to avoid a call to this function. In the previous version we always tried to keep the newest fd in the ec_lock_t structure. However this is not necessary. We'll always keep one reference to an open file on the same inode. It's irrelevant if the reference is new or old. The function __fd_unref() has also been removed from fd.h to avoid being used in the future since it's useless as it's defined now. Backport of Change-Id: Ia728777fc8e464758d5ea4d3bf020f0603919039 BUG: 1344422 Signed-off-by: Xavier Hernandez <> Reviewed-on: Smoke: Gluster Build System <> NetBSD-regression: NetBSD Build System <> CentOS-regression: Gluster Build System <> Reviewed-by: Pranith Kumar Karampuri <>
2 files changed, 1 insertions, 7 deletions
diff --git a/libglusterfs/src/fd.h b/libglusterfs/src/fd.h
index 2e93f76988a..f4a8c444198 100644
--- a/libglusterfs/src/fd.h
+++ b/libglusterfs/src/fd.h
@@ -121,9 +121,6 @@ fd_t *
fd_ref (fd_t *fd);
-fd_t *
-__fd_unref (fd_t *fd);
fd_unref (fd_t *fd);
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
index 58cfc732ced..d1cdda85b2c 100644
--- a/xlators/cluster/ec/src/ec-common.c
+++ b/xlators/cluster/ec/src/ec-common.c
@@ -1304,10 +1304,7 @@ ec_lock_update_fd(ec_lock_t *lock, ec_fop_data_t *fop)
/* If the fop has an fd available, attach it to the lock structure to be
* able to do fxattrop calls instead of xattrop. */
- if (fop->use_fd) {
- if (lock->fd != NULL) {
- __fd_unref(lock->fd);
- }
+ if (fop->use_fd && (lock->fd == NULL)) {
lock->fd = __fd_ref(fop->fd);