]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/xfs/xfs_filestream.c
ext4: fix race between writepages and enabling EXT4_EXTENTS_FL
[linux.git] / fs / xfs / xfs_filestream.c
index 5f12b5d8527a93d9a0fc50764dfa2dde138bd1c7..1a88025e68a3a73a637f8824890961ed0f0ac4c0 100644 (file)
@@ -159,16 +159,15 @@ xfs_filestream_pick_ag(
 
                if (!pag->pagf_init) {
                        err = xfs_alloc_pagf_init(mp, NULL, ag, trylock);
-                       if (err && !trylock) {
+                       if (err) {
                                xfs_perag_put(pag);
-                               return err;
+                               if (err != -EAGAIN)
+                                       return err;
+                               /* Couldn't lock the AGF, skip this AG. */
+                               continue;
                        }
                }
 
-               /* Might fail sometimes during the 1st pass with trylock set. */
-               if (!pag->pagf_init)
-                       goto next_ag;
-
                /* Keep track of the AG with the most free blocks. */
                if (pag->pagf_freeblks > maxfree) {
                        maxfree = pag->pagf_freeblks;