xfs
[Top] [All Lists]

Re: [PATCH 07/12] repair: fix another ABBA deadlock in inode prefetching

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 07/12] repair: fix another ABBA deadlock in inode prefetching
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Fri, 13 Jan 2012 12:51:45 -0600
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20111202174742.307774458@xxxxxxxxxxxxxxxxxxxxxx>
References: <20111202174619.179530033@xxxxxxxxxxxxxxxxxxxxxx> <20111202174742.307774458@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.24) Gecko/20111206 Thunderbird/3.1.16



Index: xfsprogs-dev/repair/prefetch.c
===================================================================
--- xfsprogs-dev.orig/repair/prefetch.c 2011-11-25 13:46:47.195999430 +0100
+++ xfsprogs-dev/repair/prefetch.c      2011-11-25 13:50:41.264731371 +0100
@@ -641,7 +641,18 @@ pf_queuing_worker(
                pftrace("queuing irec %p in AG %d, sem count = %d",
                        irec, args->agno, i);
  #endif
-               sem_wait(&args->ra_count);
+               err = sem_trywait(&args->ra_count);
+               if (err == EAGAIN) {
+                       /*
+                        * Kick the queue once we have reached the limit;
+                        * without this the threads processing the inodes
+                        * might get stuck on a buffer that has been locked
+                        * and added to the I/O queue but is waiting for
+                        * the thread to be woken.
+                        */
+                       pf_start_io_workers(args);
+                       sem_wait(&args->ra_count);
+               }

                num_inos = 0;
                bno = XFS_AGINO_TO_AGBNO(mp, cur_irec->ino_startnum);


Could the second sem_wait() also fail with EAGAIN?

Reviewed-by: Mark Tinguely <tinguely@xxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH 07/12] repair: fix another ABBA deadlock in inode prefetching, Mark Tinguely <=