From 4569798edd41b35bab4073e17551ecabc766f1ff Mon Sep 17 00:00:00 2001
From: shaver <shaver>
Date: Sun, 15 Feb 2004 05:03:03 +0000
Subject: [PATCH] b=2726: make sure that we properly balance page locking in
 the case of a failed writepage. patch=zab

---
 lustre/llite/file.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lustre/llite/file.c b/lustre/llite/file.c
index 6c76e87156..85e5cdc156 100644
--- a/lustre/llite/file.c
+++ b/lustre/llite/file.c
@@ -355,12 +355,12 @@ void ll_pgcache_remove_extent(struct inode *inode, struct lov_stripe_md *lsm,
 #else
                         rc = inode->i_mapping->a_ops->writepage(page, NULL);
 #endif
-                        if (rc != 0) {
+                        if (rc != 0)
                                 CERROR("writepage of page %p failed: %d\n",
                                        page, rc);
-                        } else {
-                                lock_page(page); /* wait for io to complete */
-                        }
+                        /* either waiting for io to complete or reacquiring
+                         * the lock that the failed writepage released */
+                        lock_page(page);
                 }
 
                 /* checking again to account for writeback's lock_page() */
-- 
GitLab