ceph: clean PgPrivate2 on returning from readpages
authorMilosz Tanski <milosz@adfin.com>
Wed, 21 Aug 2013 21:30:27 +0000 (17:30 -0400)
committerMilosz Tanski <milosz@adfin.com>
Fri, 6 Sep 2013 16:50:11 +0000 (16:50 +0000)
In some cases the ceph readapages code code bails without filling all the pages
already marked by fscache. When we return back to readahead code this causes
a BUG.

Signed-off-by: Milosz Tanski <milosz@adfin.com>
fs/ceph/addr.c
fs/ceph/cache.h

index 3a21a7cbc21c7227d41f06a962f4c572644266b0..1fda9cf04a8164c00d9e6364a24781b25cfb1000 100644 (file)
@@ -398,6 +398,8 @@ static int ceph_readpages(struct file *file, struct address_space *mapping,
                BUG_ON(rc == 0);
        }
 out:
+       ceph_fscache_readpages_cancel(inode, page_list);
+
        dout("readpages %p file %p ret %d\n", inode, file, rc);
        return rc;
 }
index 0ea95cb7f389c94ba6b9e7c6a45334c59673cd75..fb326fd33251aaee1d7410f7e8d0aa75220fc40c 100644 (file)
@@ -58,6 +58,13 @@ static inline int ceph_release_fscache_page(struct page *page, gfp_t gfp)
        return fscache_maybe_release_page(ci->fscache, page, gfp);
 }
 
+static inline void ceph_fscache_readpages_cancel(struct inode *inode,
+                                                struct list_head *pages)
+{
+       struct ceph_inode_info *ci = ceph_inode(inode);
+       return fscache_readpages_cancel(ci->fscache, pages);
+}
+
 #else
 
 static inline int ceph_fscache_register(void)