ceph: writepage grabs and releases inode
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 16 Dec 2009 22:51:06 +0000 (14:51 -0800)
committerSage Weil <sage@newdream.net>
Tue, 22 Dec 2009 00:39:56 +0000 (16:39 -0800)
Fixes a deadlock that is triggered due to kswapd,
while the page was locked and the iput couldn't tear
down the address space.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
fs/ceph/addr.c

index bf535815592db1882a02a1a5d8382fa38e88854b..d0cdceb0b90bfa9b87922492048ee58c5d8ca473 100644 (file)
@@ -448,8 +448,13 @@ out:
 
 static int ceph_writepage(struct page *page, struct writeback_control *wbc)
 {
-       int err = writepage_nounlock(page, wbc);
+       int err;
+       struct inode *inode = page->mapping->host;
+       BUG_ON(!inode);
+       igrab(inode);
+       err = writepage_nounlock(page, wbc);
        unlock_page(page);
+       iput(inode);
        return err;
 }