ceph: fix race of queuing delayed caps
authorYan, Zheng <zyan@redhat.com>
Mon, 8 Jan 2018 06:44:10 +0000 (14:44 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 29 Jan 2018 17:36:11 +0000 (18:36 +0100)
commit0f439c746c8cb370ce3ae1668182b18a5cb12b14
treeafea56c8ccc802f522dccf515e622329743a9610
parentee612d954fe96612afaa966d8a67b736ba0c571e
ceph: fix race of queuing delayed caps

When called with CHECK_CAPS_AUTHONLY flag, ceph_check_caps() only
processes auth caps. In that case, it's unsafe to remove inode
from mdsc->cap_delay_list, because there can be delayed non-auth
caps.

Besides, ceph_check_caps() may lock/unlock i_ceph_lock several
times, when multiple threads call ceph_check_caps() at the same
time. It's possible that one thread calls __cap_delay_requeue(),
another thread calls __cap_delay_cancel(). __cap_delay_cancel()
should be called at very beginning of ceph_check_caps(), so that
it does not race with __cap_delay_requeue().

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/caps.c