ChangeSet 1.1521.20.2, 2005/01/20 14:29:18-06:00, [EMAIL PROTECTED]

        JFS: fix livelock waiting for stale metapage
        
        Several waitors were keeping mp->count from going to zero, so we
        would never release the page.  Simplify the logic by doing a busy
        wait without locking the metapage.
        
        Signed-off-by: Dave Kleikamp <[EMAIL PROTECTED]>



 jfs_metapage.c |   23 ++++++-----------------
 1 files changed, 6 insertions(+), 17 deletions(-)


diff -Nru a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
--- a/fs/jfs/jfs_metapage.c     2005-02-23 10:05:50 -08:00
+++ b/fs/jfs/jfs_metapage.c     2005-02-23 10:05:50 -08:00
@@ -298,14 +298,14 @@
        mp = search_hash(hash_ptr, mapping, lblock);
        if (mp) {
              page_found:
-               mp->count++;
-               lock_metapage(mp);
-               spin_unlock(&meta_lock);
                if (test_bit(META_stale, &mp->flag)) {
-                       release_metapage(mp);
-                       yield();        /* Let other waiters release it, too */
+                       spin_unlock(&meta_lock);
+                       yield();
                        goto again;
                }
+               mp->count++;
+               lock_metapage(mp);
+               spin_unlock(&meta_lock);
                if (test_bit(META_discard, &mp->flag)) {
                        if (!new) {
                                jfs_error(inode->i_sb,
@@ -518,7 +518,6 @@
        }
 
        if (mp->page) {
-               /* Releasing spinlock, we have to check mp->count later */
                set_bit(META_stale, &mp->flag);
                spin_unlock(&meta_lock);
                kunmap(mp->page);
@@ -555,12 +554,6 @@
                list_del(&mp->synclist);
                LOGSYNC_UNLOCK(log);
        }
-       if (mp->count) {
-               /* Someone else is trying to get this metpage */
-               unlock_metapage(mp);
-               spin_unlock(&meta_lock);
-               return;
-       }
        remove_from_hash(mp, meta_hash(mp->mapping, mp->index));
        spin_unlock(&meta_lock);
 
@@ -589,12 +582,8 @@
                mp = search_hash(hash_ptr, mapping, lblock);
                if (mp) {
                        if (test_bit(META_stale, &mp->flag)) {
-                               /* Racing with release_metapage */
-                               mp->count++;
-                               lock_metapage(mp);
                                spin_unlock(&meta_lock);
-                               /* racing release_metapage should be done now */
-                               release_metapage(mp);
+                               yield();
                                goto again;
                        }
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-24" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to