Skip to content

Commit

Permalink
ceph: fix error handling in ceph_get_caps()
Browse files Browse the repository at this point in the history
The function return 0 even when interrupted or try_get_cap_refs()
return error.

Fixes: 1199d7d ("ceph: simplify arguments and return semantics of try_get_cap_refs")
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
Yan, Zheng authored and Ilya Dryomov committed Jun 5, 2019
1 parent 3e1d045 commit 7b2f936
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions fs/ceph/caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -2738,15 +2738,13 @@ int ceph_get_caps(struct ceph_inode_info *ci, int need, int want,
_got = 0;
ret = try_get_cap_refs(ci, need, want, endoff,
false, &_got);
if (ret == -EAGAIN) {
if (ret == -EAGAIN)
continue;
} else if (!ret) {
int err;

if (!ret) {
DEFINE_WAIT_FUNC(wait, woken_wake_function);
add_wait_queue(&ci->i_cap_wq, &wait);

while (!(err = try_get_cap_refs(ci, need, want, endoff,
while (!(ret = try_get_cap_refs(ci, need, want, endoff,
true, &_got))) {
if (signal_pending(current)) {
ret = -ERESTARTSYS;
Expand All @@ -2756,14 +2754,16 @@ int ceph_get_caps(struct ceph_inode_info *ci, int need, int want,
}

remove_wait_queue(&ci->i_cap_wq, &wait);
if (err == -EAGAIN)
if (ret == -EAGAIN)
continue;
}
if (ret == -ESTALE) {
/* session was killed, try renew caps */
ret = ceph_renew_caps(&ci->vfs_inode);
if (ret == 0)
continue;
if (ret < 0) {
if (ret == -ESTALE) {
/* session was killed, try renew caps */
ret = ceph_renew_caps(&ci->vfs_inode);
if (ret == 0)
continue;
}
return ret;
}

Expand Down

0 comments on commit 7b2f936

Please sign in to comment.