diff options
author | Xavier Hernandez <xhernandez@datalab.es> | 2016-06-09 17:29:26 +0200 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2016-06-13 03:16:17 -0700 |
commit | 3f4755ca6dce8f7aa29b4a5b48682e04c3e7587b (patch) | |
tree | dd148e7144a06a3d288993dd52d3190c538f413f /xlators | |
parent | d48865c1e2240aed9b46632f373a0a090b6f0931 (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 http://review.gluster.org/14683
Change-Id: Ia728777fc8e464758d5ea4d3bf020f0603919039
BUG: 1344421
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/14684
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/ec/src/ec-common.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c index 009fad2f896..c32a28d2ed1 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); } } |