diff options
author | Zhou Zhengping <johnzzpcrystal@gmail.com> | 2017-05-03 17:51:57 +0800 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-05-03 16:30:46 +0000 |
commit | 7178c299d727e98370835ba3dde41f91f087e724 (patch) | |
tree | 6c6a1da636b4a5993d9c14684bc876c51dab7b29 /xlators | |
parent | 4f7ef3020edcc75cdeb22d8da8a1484f9db77ac9 (diff) |
server: fd should be refed before put into fdtable
If a network error occurs after we put a fd to fdtable,
fds in fdtable will be cleaned up by do_fd_cleanup which will
unref the fd and release the fd if the fd hasn't be refed by user.
Change-Id: Idbad0fafd005c59398518190845fe137cbf95c60
BUG: 1447609
Signed-off-by: Zhou Zhengping <johnzzpcrystal@gmail.com>
Reviewed-on: https://review.gluster.org/17158
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Milind Changire <mchangir@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/protocol/server/src/server-common.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/xlators/protocol/server/src/server-common.c b/xlators/protocol/server/src/server-common.c index 4a55e7e75f3..1dc3a9cf9bd 100644 --- a/xlators/protocol/server/src/server-common.c +++ b/xlators/protocol/server/src/server-common.c @@ -334,8 +334,8 @@ server_post_open (call_frame_t *frame, xlator_t *this, } fd_bind (fd); - fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd); fd_ref (fd); + fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd); rsp->fd = fd_no; return 0; @@ -364,8 +364,8 @@ server_post_opendir (call_frame_t *frame, xlator_t *this, } fd_bind (fd); - fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd); fd_ref (fd); + fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd); rsp->fd = fd_no; return 0; @@ -414,8 +414,8 @@ server_post_create (call_frame_t *frame, gfs3_create_rsp *rsp, } fd_bind (fd); - fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd); fd_ref (fd); + fd_no = gf_fd_unused_get (serv_ctx->fdtable, fd); if ((fd_no > UINT64_MAX) || (fd == 0)) { op_errno = errno; |