|
|
3604df |
From 16490747ddee6f2233665856ffc8108ccfc78f99 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Soumya Koduri <skoduri@redhat.com>
|
|
|
3604df |
Date: Mon, 26 Sep 2016 14:54:27 +0530
|
|
|
3604df |
Subject: [PATCH 095/141] gfapi: Fix few fd ref leaks
|
|
|
3604df |
|
|
|
3604df |
From the code inspection, have observed that there are fd ref
|
|
|
3604df |
leaks for few fd-based gfapi fops. 'glfs_resolve_fd' returns
|
|
|
3604df |
a fd (either existing or migrated) with an extra ref taken.
|
|
|
3604df |
This needs to be unref'ed at the end of the operation.
|
|
|
3604df |
|
|
|
3604df |
Mainline reference:
|
|
|
3604df |
> Change-Id: Id63394e3e7deafb0c8b06444f2ae847248b126db
|
|
|
3604df |
> BUG: 1379285
|
|
|
3604df |
> Signed-off-by: Soumya Koduri <skoduri@redhat.com>
|
|
|
3604df |
> Reviewed-on: http://review.gluster.org/15573
|
|
|
3604df |
> Reviewed-by: Niels de Vos <ndevos@redhat.com>
|
|
|
3604df |
(cherry picked from commit d27cffab670858d7812bbb458a0833303d009b3b)
|
|
|
3604df |
|
|
|
3604df |
upstream release-3.8 reference:
|
|
|
3604df |
> Change-Id: I0919abbddb618d08aaf77b2ce1173eec18b382f1
|
|
|
3604df |
> BUG: 1379708
|
|
|
3604df |
> Signed-off-by: Soumya Koduri <skoduri@redhat.com>
|
|
|
3604df |
> Reviewed-on: http://review.gluster.org/15585
|
|
|
3604df |
> Reviewed-by: Niels de Vos <ndevos@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
BUG: 1379924
|
|
|
3604df |
Change-Id: I3953a3cfa9b220e95bc07c6816a410030147e0ef
|
|
|
3604df |
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/86107
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
api/src/glfs-fops.c | 21 +++++++++++++++++++++
|
|
|
3604df |
1 files changed, 21 insertions(+), 0 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
|
|
|
3604df |
index 9c31502..bbbf61d 100644
|
|
|
3604df |
--- a/api/src/glfs-fops.c
|
|
|
3604df |
+++ b/api/src/glfs-fops.c
|
|
|
3604df |
@@ -601,6 +601,9 @@ glfs_seek (struct glfs_fd *glfd, off_t offset, int whence)
|
|
|
3604df |
glfd->offset = off;
|
|
|
3604df |
|
|
|
3604df |
done:
|
|
|
3604df |
+ if (fd)
|
|
|
3604df |
+ fd_unref (fd);
|
|
|
3604df |
+
|
|
|
3604df |
glfs_subvol_done (glfd->fs, subvol);
|
|
|
3604df |
|
|
|
3604df |
out:
|
|
|
3604df |
@@ -931,6 +934,9 @@ pub_glfs_preadv_async (struct glfs_fd *glfd, const struct iovec *iovec,
|
|
|
3604df |
offset, flags, NULL);
|
|
|
3604df |
|
|
|
3604df |
out:
|
|
|
3604df |
+ if (fd)
|
|
|
3604df |
+ fd_unref (fd);
|
|
|
3604df |
+
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
if (glfd)
|
|
|
3604df |
GF_REF_PUT (glfd);
|
|
|
3604df |
@@ -1246,6 +1252,9 @@ pub_glfs_pwritev_async (struct glfs_fd *glfd, const struct iovec *iovec,
|
|
|
3604df |
|
|
|
3604df |
ret = 0;
|
|
|
3604df |
out:
|
|
|
3604df |
+ if (fd)
|
|
|
3604df |
+ fd_unref (fd);
|
|
|
3604df |
+
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
if (glfd)
|
|
|
3604df |
GF_REF_PUT (glfd);
|
|
|
3604df |
@@ -1430,6 +1439,9 @@ glfs_fsync_async_common (struct glfs_fd *glfd, glfs_io_cbk fn, void *data,
|
|
|
3604df |
subvol->fops->fsync, fd, dataonly, NULL);
|
|
|
3604df |
|
|
|
3604df |
out:
|
|
|
3604df |
+ if (fd)
|
|
|
3604df |
+ fd_unref (fd);
|
|
|
3604df |
+
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
if (glfd)
|
|
|
3604df |
GF_REF_PUT (glfd);
|
|
|
3604df |
@@ -1681,6 +1693,9 @@ pub_glfs_ftruncate_async (struct glfs_fd *glfd, off_t offset, glfs_io_cbk fn,
|
|
|
3604df |
ret = 0;
|
|
|
3604df |
|
|
|
3604df |
out:
|
|
|
3604df |
+ if (fd)
|
|
|
3604df |
+ fd_unref (fd);
|
|
|
3604df |
+
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
if (glfd)
|
|
|
3604df |
GF_REF_PUT (glfd);
|
|
|
3604df |
@@ -2537,6 +2552,9 @@ pub_glfs_discard_async (struct glfs_fd *glfd, off_t offset, size_t len,
|
|
|
3604df |
|
|
|
3604df |
ret = 0;
|
|
|
3604df |
out:
|
|
|
3604df |
+ if (fd)
|
|
|
3604df |
+ fd_unref (fd);
|
|
|
3604df |
+
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
if (glfd)
|
|
|
3604df |
GF_REF_PUT (glfd);
|
|
|
3604df |
@@ -2622,6 +2640,9 @@ pub_glfs_zerofill_async (struct glfs_fd *glfd, off_t offset, off_t len,
|
|
|
3604df |
subvol->fops->zerofill, fd, offset, len, NULL);
|
|
|
3604df |
ret = 0;
|
|
|
3604df |
out:
|
|
|
3604df |
+ if (fd)
|
|
|
3604df |
+ fd_unref (fd);
|
|
|
3604df |
+
|
|
|
3604df |
if (ret) {
|
|
|
3604df |
if (glfd)
|
|
|
3604df |
GF_REF_PUT (glfd);
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|