eCryptfs: Revert to a writethrough cache model
[pandora-kernel.git] / fs / ecryptfs / mmap.c
index 519af27..93a998a 100644 (file)
@@ -70,8 +70,8 @@ static int ecryptfs_writepage(struct page *page, struct writeback_control *wbc)
                goto out;
        }
        SetPageUptodate(page);
-       unlock_page(page);
 out:
+       unlock_page(page);
        return rc;
 }
 
@@ -369,6 +369,11 @@ static int ecryptfs_write_begin(struct file *file,
            && (pos != 0))
                zero_user(page, 0, PAGE_CACHE_SIZE);
 out:
+       if (unlikely(rc)) {
+               unlock_page(page);
+               page_cache_release(page);
+               *pagep = NULL;
+       }
        return rc;
 }