connection: add kdbus_conn_reply.interrupted
authorDaniel Mack <daniel@zonque.org>
Tue, 28 Oct 2014 11:44:39 +0000 (12:44 +0100)
committerDaniel Mack <daniel@zonque.org>
Tue, 28 Oct 2014 11:44:39 +0000 (12:44 +0100)
Add a new boolean flag to track reply objects affected by interrupted
system calls. Treat such object as non-sync in kdbus_conn_work().

This patch does not add any user that sets this flag yet.

Signed-off-by: Daniel Mack <daniel@zonque.org>
connection.c

index 13ad1d4de262de870b4cfde9880056288dd8b75a..00872aa96951b2b934050ddbb76af597f9325a6b 100644 (file)
@@ -60,6 +60,7 @@ struct kdbus_conn_reply;
  * @name_id:           ID of the well-known name the original msg was sent to
  * @sync:              The reply block is waiting for synchronous I/O
  * @waiting:           The condition to synchronously wait for
+ * @interrupted:       The sync reply was left in an interrupted state
  * @err:               The error code for the synchronous reply
  */
 struct kdbus_conn_reply {
@@ -72,6 +73,7 @@ struct kdbus_conn_reply {
        u64 name_id;
        bool sync:1;
        bool waiting:1;
+       bool interrupted:1;
        int err;
 };
 
@@ -228,7 +230,7 @@ static void kdbus_conn_work(struct work_struct *work)
                 * the timeout is handled by wait_event_*_timeout(),
                 * so we don't have to care for it here.
                 */
-               if (reply->sync)
+               if (reply->sync && !reply->interrupted)
                        continue;
 
                if (reply->deadline_ns > now) {
@@ -242,8 +244,10 @@ static void kdbus_conn_work(struct work_struct *work)
                /*
                 * A zero deadline means the connection died, was
                 * cleaned up already and the notification was sent.
+                * Don't send notifications for reply trackers that were
+                * left in an interrupted syscall state.
                 */
-               if (reply->deadline_ns != 0)
+               if (reply->deadline_ns != 0 && !reply->interrupted)
                        kdbus_notify_reply_timeout(conn->bus,
                                                   reply->reply_dst->id,
                                                   reply->cookie);