]> git.baikalelectronics.ru Git - kernel.git/commit
ceph: don't skip updating wanted caps when cap is stale
authorYan, Zheng <zyan@redhat.com>
Tue, 10 Mar 2020 11:34:20 +0000 (19:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Apr 2020 14:32:58 +0000 (16:32 +0200)
commit9f13ac18a926fa1ff98e5578464b58f81772c611
treeb1049f6d5ceabbebdf526d83bd56f23808c1d3a9
parent1fd559c102e7a027ec72f9e6fdc6b72b99620598
ceph: don't skip updating wanted caps when cap is stale

[ Upstream commit ca82387ac1206f072af9ed21987a9aa92d08fc97 ]

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" <zyan@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ceph/caps.c