summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server-helpers.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-03-18 13:07:30 +0530
committerAnand Avati <avati@redhat.com>2012-03-18 01:09:43 -0700
commit9fd44bd90ecb60760919bda85308132341f857f9 (patch)
tree0ed134e638c906ca8ae66153a1f5f00ddde28c12 /xlators/protocol/server/src/server-helpers.c
parentf20d895a8ed2a3ee032bd0f85d5bfaf645575fd7 (diff)
protocol/server: Clear internal locks on disconnect
If there is a disconnect observed on the client when the inode/entry unlock is issued, but the reconnection to server happens with in the grace-time period the inode/entry lk will live and the unlock will never come from that client. The internal locks should be cleared on disconnect. Change-Id: Ib45b1035cfe3b1de381ef3b331c930011e7403be BUG: 803209 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/2966 Reviewed-by: Anand Avati <avati@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/protocol/server/src/server-helpers.c')
-rw-r--r--xlators/protocol/server/src/server-helpers.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 40b1efc9b95..adcf9c1f1ed 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -506,15 +506,17 @@ do_connection_cleanup (xlator_t *this, server_connection_t *conn,
GF_VALIDATE_OR_GOTO ("server", this, out);
GF_VALIDATE_OR_GOTO ("server", conn, out);
- GF_VALIDATE_OR_GOTO ("server", fdentries, out);
- GF_VALIDATE_OR_GOTO ("server", ltable, out);
+
+ if (!ltable && !fdentries)
+ goto out;
frame = create_frame (this, this->ctx->pool);
if (frame == NULL) {
goto out;
}
- saved_ret = do_lock_table_cleanup (this, conn, frame, ltable);
+ if (ltable)
+ saved_ret = do_lock_table_cleanup (this, conn, frame, ltable);
if (fdentries != NULL) {
ret = do_fd_cleanup (this, conn, frame, fdentries, fd_count);
@@ -536,24 +538,26 @@ out:
int
-server_connection_cleanup (xlator_t *this, server_connection_t *conn)
+server_connection_cleanup (xlator_t *this, server_connection_t *conn,
+ int32_t flags)
{
struct _lock_table *ltable = NULL;
fdentry_t *fdentries = NULL;
uint32_t fd_count = 0;
int ret = 0;
- GF_VALIDATE_OR_GOTO ("server", this, out);
- GF_VALIDATE_OR_GOTO ("server", conn, out);
+ GF_VALIDATE_OR_GOTO (this->name, this, out);
+ GF_VALIDATE_OR_GOTO (this->name, conn, out);
+ GF_VALIDATE_OR_GOTO (this->name, flags, out);
pthread_mutex_lock (&conn->lock);
{
- if (conn->ltable) {
+ if (conn->ltable && (flags & INTERNAL_LOCKS)) {
ltable = conn->ltable;
conn->ltable = gf_lock_table_new ();
}
- if (conn->fdtable)
+ if (conn->fdtable && (flags & POSIX_LOCKS))
fdentries = gf_fd_fdtable_get_all_fds (conn->fdtable,
&fd_count);
}