From 9795fabb63f6b6b291c1054ca578b213a6a0bf83 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 24 Jun 2010 15:50:47 -0700 Subject: [PATCH] mds: fix client cap condition In 551a12f52e36 we fixed a bug with cow_inode() where the cap->client_follows didn't match last precisely. Instead, we compare to first. But the == is too strict.. cap follows that is equal _or_older_ than the clone's first should be copied to the clone inode. This fixes the simple test case $ echo asdf > bar ; mkdir .snap/bar ; rm bar ; cat .snap/bar/bar asdf (Previously we would get nothing unless we waited for the cap to flush on its own.) --- src/mds/MDCache.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 3eb5f6508c983..2b1b10da9fbfc 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -1262,7 +1262,7 @@ CInode *MDCache::cow_inode(CInode *in, snapid_t last) in->first = last+1; - dout(10) << "cow_inode to " << *oldin << dendl; + dout(10) << "cow_inode " << *in << " to " << *oldin << dendl; add_inode(oldin); // clone caps? @@ -1272,7 +1272,7 @@ CInode *MDCache::cow_inode(CInode *in, snapid_t last) client_t client = p->first; Capability *cap = p->second; if ((cap->issued() & CEPH_CAP_ANY_WR) && - cap->client_follows == oldin->first) { + cap->client_follows <= oldin->first) { // clone to oldin Capability *newcap = oldin->add_client_cap(client, 0, in->containing_realm); cap->item_session_caps.get_list()->push_back(&newcap->item_session_caps); -- 2.39.5