Skip to content

Commit 0aa971b

Browse files
ukernelidryomov
authored andcommitted
ceph: don't skip updating wanted caps when cap is stale
1. try_get_cap_refs() fails to get caps and finds that mds_wanted does not include what it wants. It returns -ESTALE. 2. ceph_get_caps() calls ceph_renew_caps(). ceph_renew_caps() finds that inode has cap, so it calls ceph_check_caps(). 3. ceph_check_caps() finds that issued caps (without checking if it's stale) already includes caps wanted by open file, so it skips updating wanted caps. Above events can cause an infinite loop inside ceph_get_caps(). Signed-off-by: "Yan, Zheng" <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 42d70f8 commit 0aa971b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/ceph/caps.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,8 +2008,12 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
20082008
}
20092009

20102010
/* want more caps from mds? */
2011-
if (want & ~(cap->mds_wanted | cap->issued))
2012-
goto ack;
2011+
if (want & ~cap->mds_wanted) {
2012+
if (want & ~(cap->mds_wanted | cap->issued))
2013+
goto ack;
2014+
if (!__cap_is_valid(cap))
2015+
goto ack;
2016+
}
20132017

20142018
/* things we might delay */
20152019
if ((cap->issued & ~retain) == 0)

0 commit comments

Comments
 (0)