connection: only schedule timeout scan for async operation
authorDaniel Mack <zonque@gmail.com>
Sat, 18 Jan 2014 11:42:47 +0000 (12:42 +0100)
committerDaniel Mack <zonque@gmail.com>
Sat, 18 Jan 2014 11:42:47 +0000 (12:42 +0100)
connection.c

index f1c25904079099c5618e043e09f40bdf128c7ec0..af7c697ba79f3968fa339953a7f4ec5f9bca7dc5 100644 (file)
@@ -1128,7 +1128,16 @@ int kdbus_conn_kmsg_send(struct kdbus_ep *ep,
                atomic_inc(&reply->conn->reply_count);
                mutex_unlock(&conn_src->lock);
 
-               kdbus_conn_timeout_schedule_scan(conn_src);
+               /*
+                * For async operation, schedule the scan now. It won't do
+                * any real work at this point, but walk the list of all
+                * pending replies and re-arm the timer to the closest
+                * entry.
+                * For synchronous operation, the timeout will be handled
+                * by wait_event_interruptible_timeout().
+                */
+               if (!reply_wait)
+                       kdbus_conn_timeout_schedule_scan(conn_src);
        }
 
        if (conn_src) {