summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-resolve.c
diff options
context:
space:
mode:
authorRajesh Joseph <rjoseph@redhat.com>2016-11-22 22:25:42 +0530
committerNiels de Vos <ndevos@redhat.com>2016-11-29 23:52:42 -0800
commit17d10b42fc4041442e6cd0bfda45944edea498c6 (patch)
tree60abd1b7b5ad506e2b8d5455431188c4d6a08b5f /api/src/glfs-resolve.c
parente34a783557e504f0793f18beb850bcebbb2af7fa (diff)
gfapi: glfs_subvol_done should NOT wait for graph migration.
In graph_setup function glfs_subvol_done is called which is executed in an epoll thread. glfs_lock waits on other thread to finish graph migration. This can lead to dead lock if we consume all the epoll threads. In general any call-back function executed in epoll thread should not call any blocking call which waits on a network reply either directly or indirectly, e.g. syncop functions should not be called in these threads. As a fix we should not wait for migration in the call-back path. Change-Id: If96d0689fe1b4d74631e383048cdc30b01690dc2 BUG: 1397754 Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-on: http://review.gluster.org/15913 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'api/src/glfs-resolve.c')
-rw-r--r--api/src/glfs-resolve.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index b84e5d8f58c..f8b437bab0e 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -784,7 +784,7 @@ glfs_resolve_fd (struct glfs *fs, xlator_t *subvol, struct glfs_fd *glfd)
{
fd_t *fd = NULL;
- glfs_lock (fs);
+ glfs_lock (fs, _gf_true);
{
fd = __glfs_resolve_fd (fs, subvol, glfd);
}
@@ -897,12 +897,17 @@ priv_glfs_subvol_done (struct glfs *fs, xlator_t *subvol)
if (!subvol)
return;
- glfs_lock (fs);
+ /* For decrementing subvol->wind ref count we need not check/wait for
+ * migration-in-progress flag.
+ * Also glfs_subvol_done is called in call-back path therefore waiting
+ * fot migration-in-progress flag can lead to dead-lock.
+ */
+ glfs_lock (fs, _gf_false);
{
ref = (--subvol->winds);
active_subvol = fs->active_subvol;
}
- glfs_unlock (fs);
+ glfs_unlock (fs);
if (ref == 0) {
assert (subvol != active_subvol);
@@ -919,7 +924,7 @@ priv_glfs_active_subvol (struct glfs *fs)
xlator_t *subvol = NULL;
xlator_t *old_subvol = NULL;
- glfs_lock (fs);
+ glfs_lock (fs, _gf_true);
{
subvol = __glfs_active_subvol (fs);
@@ -968,7 +973,7 @@ glfs_cwd_set (struct glfs *fs, inode_t *inode)
{
int ret = 0;
- glfs_lock (fs);
+ glfs_lock (fs, _gf_true);
{
ret = __glfs_cwd_set (fs, inode);
}
@@ -1001,7 +1006,7 @@ glfs_cwd_get (struct glfs *fs)
{
inode_t *cwd = NULL;
- glfs_lock (fs);
+ glfs_lock (fs, _gf_true);
{
cwd = __glfs_cwd_get (fs);
}
@@ -1041,7 +1046,7 @@ glfs_resolve_inode (struct glfs *fs, xlator_t *subvol,
{
inode_t *inode = NULL;
- glfs_lock (fs);
+ glfs_lock (fs, _gf_true);
{
inode = __glfs_resolve_inode(fs, subvol, object);
}