ceph: try to allocate enough memory for reserved caps
authorZhi Zhang <zhang.david2011@gmail.com>
Wed, 24 Jan 2018 13:24:33 +0000 (21:24 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 29 Jan 2018 17:36:12 +0000 (18:36 +0100)
commite30ee58121e34831b9665934d70dbc72ab0fe2fb
tree23b4eb7cb77f82d5326efbe3af44d152aa75a953
parent0f439c746c8cb370ce3ae1668182b18a5cb12b14
ceph: try to allocate enough memory for reserved caps

ceph_reserve_caps() may not reserve enough caps under high memory
pressure, but it saved the needed caps number that expected to
be reserved. When getting caps, crash would happen due to number
mismatch.

Now we will try to trim more caps when failing to allocate memory
for caps need to be reserved, then try again. If still failing to
allocate memory, return -ENOMEM.

Signed-off-by: Zhi Zhang <zhang.david2011@gmail.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/caps.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h
fs/ceph/super.h