int file_wanted, used;
int took_snap_rwsem = 0; /* true if mdsc->snap_rwsem held */
int drop_session_lock = session ? 0 : 1;
- int want, retain, revoking, flushing = 0;
+ int issued, implemented, want, retain, revoking, flushing = 0;
int mds = -1; /* keep track of how far we've gone through i_caps list
to avoid an infinite loop on retry */
struct rb_node *p;
int tried_invalidate = 0;
int delayed = 0, sent = 0, force_requeue = 0, num;
+ int queue_invalidate = 0;
int is_delayed = flags & CHECK_CAPS_NODELAY;
/* if we are unmounting, flush any unused caps immediately. */
file_wanted = __ceph_caps_file_wanted(ci);
used = __ceph_caps_used(ci);
want = file_wanted | used;
+ issued = __ceph_caps_issued(ci, &implemented);
+ revoking = implemented & ~issued;
retain = want | CEPH_CAP_PIN;
if (!mdsc->stopping && inode->i_nlink > 0) {
}
dout("check_caps %p file_want %s used %s dirty %s flushing %s"
- " issued %s retain %s %s%s%s\n", inode,
+ " issued %s revoking %s retain %s %s%s%s\n", inode,
ceph_cap_string(file_wanted),
ceph_cap_string(used), ceph_cap_string(ci->i_dirty_caps),
ceph_cap_string(ci->i_flushing_caps),
- ceph_cap_string(__ceph_caps_issued(ci, NULL)),
+ ceph_cap_string(issued), ceph_cap_string(revoking),
ceph_cap_string(retain),
(flags & CHECK_CAPS_AUTHONLY) ? " AUTHONLY" : "",
(flags & CHECK_CAPS_NODELAY) ? " NODELAY" : "",
if ((!is_delayed || mdsc->stopping) &&
ci->i_wrbuffer_ref == 0 && /* no dirty pages... */
ci->i_rdcache_gen && /* may have cached pages */
- file_wanted == 0 && /* no open files */
+ (file_wanted == 0 || /* no open files */
+ (revoking & CEPH_CAP_FILE_CACHE)) && /* or revoking cache */
!ci->i_truncate_pending &&
!tried_invalidate) {
u32 invalidating_gen = ci->i_rdcache_gen;
/* success. */
ci->i_rdcache_gen = 0;
ci->i_rdcache_revoking = 0;
+ } else if (revoking & CEPH_CAP_FILE_CACHE) {
+ dout("check_caps queuing invalidate\n");
+ queue_invalidate = 1;
+ ci->i_rdcache_revoking = ci->i_rdcache_gen;
} else {
dout("check_caps failed to invalidate pages\n");
/* we failed to invalidate pages. check these
revoking = cap->implemented & ~cap->issued;
if (revoking)
- dout("mds%d revoking %s\n", cap->mds,
+ dout(" mds%d revoking %s\n", cap->mds,
ceph_cap_string(revoking));
if (cap == ci->i_auth_cap &&
spin_unlock(&inode->i_lock);
+ if (queue_invalidate)
+ if (ceph_queue_page_invalidation(inode))
+ igrab(inode);
+
if (session && drop_session_lock)
mutex_unlock(&session->s_mutex);
if (took_snap_rwsem)