ceph: only invalidate on check_caps if we actually have pages
authorSage Weil <sage@newdream.net>
Fri, 17 Sep 2010 15:38:25 +0000 (08:38 -0700)
committerSage Weil <sage@newdream.net>
Wed, 20 Oct 2010 22:38:15 +0000 (15:38 -0700)
The i_rdcache_gen value only implies we MAY have cached pages; actually
check the mapping to see if it's worth bothering with an invalidate.

Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/caps.c

index 3cff67cbb9c08724e03d128982173c6700dfa13b..3c03460f48bd9ada890d6f014a7b1120927e4b3a 100644 (file)
@@ -1534,7 +1534,7 @@ retry_locked:
         */
        if ((!is_delayed || mdsc->stopping) &&
            ci->i_wrbuffer_ref == 0 &&               /* no dirty pages... */
-           ci->i_rdcache_gen &&                     /* may have cached pages */
+           inode->i_data.nrpages &&                 /* have cached pages */
            (file_wanted == 0 ||                     /* no open files */
             (revoking & (CEPH_CAP_FILE_CACHE|
                          CEPH_CAP_FILE_LAZYIO))) && /*  or revoking cache */