[DLM] fix softlockup in dlm_recv [54/54]

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Steven Whitehouse
Date: Monday, February 5, 2007 - 7:50 am

>From aee6c8244dea3199ff3d17fc3167660ea95299ec Mon Sep 17 00:00:00 2001
From: Patrick Caulfield <pcaulfie@redhat.com>
Date: Thu, 1 Feb 2007 16:46:33 +0000
Subject: [PATCH] [DLM] fix softlockup in dlm_recv

This patch stops the dlm_recv workqueue from busy-waiting when a node
disconnects. This can cause soft lockup errors on debug systems and bad
performance generally.

Signed-Off-By: Patrick Caulfield <pcaulfie@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/dlm/lowcomms-tcp.c b/fs/dlm/lowcomms-tcp.c
index 18ade44..f1efd17 100644
--- a/fs/dlm/lowcomms-tcp.c
+++ b/fs/dlm/lowcomms-tcp.c
@@ -2,7 +2,7 @@
 *******************************************************************************
 **
 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
-**  Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -109,7 +109,6 @@ struct connection {
 	struct page *rx_page;
 	struct cbuf cb;
 	int retries;
-	atomic_t waiting_requests;
 #define MAX_CONNECT_RETRIES 3
 	struct connection *othercon;
 	struct work_struct rwork; /* Receive workqueue */
@@ -278,8 +277,11 @@ static int receive_from_sock(struct connection *con)
 
 	mutex_lock(&con->sock_mutex);
 
-	if (con->sock == NULL)
-		goto out;
+	if (con->sock == NULL) {
+		ret = -EAGAIN;
+		goto out_close;
+	}
+
 	if (con->rx_page == NULL) {
 		/*
 		 * This doesn't need to be atomic, but I think it should
@@ -352,7 +354,6 @@ static int receive_from_sock(struct connection *con)
 		con->rx_page = NULL;
 	}
 
-out:
 	if (call_again_soon)
 		goto out_resched;
 	mutex_unlock(&con->sock_mutex);
@@ -370,6 +371,9 @@ out_close:
 		close_connection(con, false);
 		/* Reconnect when there is something to send */
 	}
+	/* Don't return success if we really got EOF */
+	if (ret == 0)
+		ret = -EAGAIN;
 
 	return ret;
 }
@@ -847,7 +851,6 @@ int dlm_lowcomms_close(int nodeid)
 	if (con) {
 		clean_one_writequeue(con);
 		close_connection(con, true);
-		atomic_set(&con->waiting_requests, 0);
 	}
 	return 0;
 
-- 
1.4.4.2



-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GFS2] don't try to lockfs after shutdown [1/54], Steven Whitehouse, (Mon Feb 5, 7:09 am)
[DLM] fix resend rcom lock [2/54], Steven Whitehouse, (Mon Feb 5, 7:09 am)
[DLM] fix old rcom messages [3/54], Steven Whitehouse, (Mon Feb 5, 7:10 am)
[DLM] add version check [4/54], Steven Whitehouse, (Mon Feb 5, 7:11 am)
[DLM] fix send_args() lvb copying [5/54], Steven Whitehouse, (Mon Feb 5, 7:12 am)
[DLM] fix receive_request() lvb copying [6/54], Steven Whitehouse, (Mon Feb 5, 7:13 am)
[DLM] fix lost flags in stub replies, Steven Whitehouse, (Mon Feb 5, 7:14 am)
[DLM] fs/dlm/lowcomms-tcp.c: remove 2 functions [8/54], Steven Whitehouse, (Mon Feb 5, 7:15 am)
[GFS2] Fix DIO deadlock [9/54], Steven Whitehouse, (Mon Feb 5, 7:16 am)
[GFS2] Fail over to readpage for stuffed files [10/54], Steven Whitehouse, (Mon Feb 5, 7:17 am)
[GFS2] Fix change nlink deadlock [11/54], Steven Whitehouse, (Mon Feb 5, 7:18 am)
[DLM] Fix schedule() calls [12/54], Steven Whitehouse, (Mon Feb 5, 7:19 am)
[DLM] Fix spin lock already unlocked bug [13/54], Steven Whitehouse, (Mon Feb 5, 7:19 am)
[GFS2] Fix ordering of page disposal vs. glock_dq [14/54], Steven Whitehouse, (Mon Feb 5, 7:20 am)
[GFS2] BZ 217008 fsfuzzer fix [15/54], Steven Whitehouse, (Mon Feb 5, 7:21 am)
[GFS2] Fix gfs2_rename deadlock [16/54], Steven Whitehouse, (Mon Feb 5, 7:22 am)
[DLM] change some log_error to log_debug [17/54], Steven Whitehouse, (Mon Feb 5, 7:22 am)
[DLM] rename dlm_config_info fields [18/54], Steven Whitehouse, (Mon Feb 5, 7:23 am)
[DLM] add config entry to enable log_debug [16/54], Steven Whitehouse, (Mon Feb 5, 7:24 am)
[DLM] expose dlm_config_info fields in configfs [20/54], Steven Whitehouse, (Mon Feb 5, 7:25 am)
[GFS2] make gfs2_change_nlink_i() static [22/54], Steven Whitehouse, (Mon Feb 5, 7:27 am)
[DLM] Use workqueues for dlm lowcomms [23/54], Steven Whitehouse, (Mon Feb 5, 7:28 am)
[DLM] fix user unlocking [24/54], Steven Whitehouse, (Mon Feb 5, 7:29 am)
[DLM] fix master recovery [25/54], Steven Whitehouse, (Mon Feb 5, 7:29 am)
[GFS2] Clean up/speed up readdir [27/54], Steven Whitehouse, (Mon Feb 5, 7:31 am)
[GFS2] Remove max_atomic_write tunable [28/54], Steven Whitehouse, (Mon Feb 5, 7:31 am)
[GFS2] Shrink gfs2_inode memory by half [29/54], Steven Whitehouse, (Mon Feb 5, 7:32 am)
[GFS2] Remove unused go_callback operation [31/54], Steven Whitehouse, (Mon Feb 5, 7:34 am)
[GFS2] Remove local exclusive glock mode [32/54], Steven Whitehouse, (Mon Feb 5, 7:34 am)
[DLM] lowcomms tidy [33/54], Steven Whitehouse, (Mon Feb 5, 7:35 am)
[GFS2] Tidy up glops calls [34/54], Steven Whitehouse, (Mon Feb 5, 7:35 am)
[DLM] fix lowcomms receiving [35/54], Steven Whitehouse, (Mon Feb 5, 7:36 am)
[GFS2] Remove queue_empty() function [36/54], Steven Whitehouse, (Mon Feb 5, 7:37 am)
[GFS2] Compile fix for glock.c [37/54], Steven Whitehouse, (Mon Feb 5, 7:37 am)
[GFS2] Fix typo in glock.c [39/54], Steven Whitehouse, (Mon Feb 5, 7:39 am)
[DLM] Make sock_sem into a mutex [40/54], Steven Whitehouse, (Mon Feb 5, 7:40 am)
[DLM] saved dlm message can be dropped [41/54], Steven Whitehouse, (Mon Feb 5, 7:40 am)
[DLM] can miss clearing resend flag, Steven Whitehouse, (Mon Feb 5, 7:41 am)
[GFS2] Fix recursive locking attempt with NFS [43/54], Steven Whitehouse, (Mon Feb 5, 7:41 am)
[GFS2] Fix list corruption in lops.c [44/54], Steven Whitehouse, (Mon Feb 5, 7:42 am)
[GFS2] increase default lock limit [45/54], Steven Whitehouse, (Mon Feb 5, 7:43 am)
[GFS2] make lock_dlm drop_count tunable in sysfs [46/54], Steven Whitehouse, (Mon Feb 5, 7:44 am)
[GFS2/DLM] use sysfs, Steven Whitehouse, (Mon Feb 5, 7:44 am)
[GFS2/DLM] fix GFS2 circular dependency [48/54], Steven Whitehouse, (Mon Feb 5, 7:45 am)
[GFS2] more CURRENT_TIME_SEC [49/54], Steven Whitehouse, (Mon Feb 5, 7:46 am)
[GFS2] Put back semaphore to avoid umount proble, Steven Whitehouse, (Mon Feb 5, 7:47 am)
[GFS2] Fix unlink deadlocks [51/54], Steven Whitehouse, (Mon Feb 5, 7:47 am)
[DLM/GFS2] indent help text [52/54], Steven Whitehouse, (Mon Feb 5, 7:48 am)
[DLM] zero new user lvbs [53/54], Steven Whitehouse, (Mon Feb 5, 7:49 am)
[DLM] fix softlockup in dlm_recv [54/54], Steven Whitehouse, (Mon Feb 5, 7:50 am)
[GFS2 &amp; DLM] Pull request, Steven Whitehouse, (Wed Feb 7, 6:20 am)