linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* btrfs/078 may got stuck in the __wait_on_atomic_t
@ 2015-04-24 12:08 George Wang
  2015-04-24 14:03 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: George Wang @ 2015-04-24 12:08 UTC (permalink / raw)
  To: dhowells; +Cc: linux-btrfs

Hi, I got stuck by btrfs/078 with 1 cpu(2 core) machine. And I notice
this patch maybe the
root cause of it.

commit cb65537ee1134d3cc55c1fa83952bc8eb1212833
Author: David Howells <dhowells@redhat.com>
Date:   Fri May 10 19:50:26 2013 +0100

    Add wait_on_atomic_t() and wake_up_atomic_t()
<snip>
+/*
+ * To allow interruptible waiting and asynchronous (i.e. nonblocking) waiting,
+ * the actions of __wait_on_atomic_t() are permitted return codes.  Nonzero
+ * return codes halt waiting and return.
+ */
+static __sched
+int __wait_on_atomic_t(wait_queue_head_t *wq, struct wait_bit_queue *q,
+                      int (*action)(atomic_t *), unsigned mode)
+{
+       atomic_t *val;
+       int ret = 0;
+
+       do {
+               prepare_to_wait(wq, &q->wait, mode);
+               val = q->key.flags;
+               if (atomic_read(val) == 0)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^here,
is this judge ok? if the val not 0,

the most thing we want to do is schedule.
+                       ret = (*action)(val);
+       } while (!ret && atomic_read(val) != 0);
+       finish_wait(wq, &q->wait);
+       return ret;
+}

Thanks,
George

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-24 14:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24 12:08 btrfs/078 may got stuck in the __wait_on_atomic_t George Wang
2015-04-24 14:03 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).