summaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2019-05-19 21:50:09 -0400
committerIlya Dryomov <idryomov@gmail.com>2019-06-05 14:34:39 -0400
commit7b2f936fc8282ab56d4d21247f2f9c21607c085c (patch)
treebc9dba2c3671d20c1753ffae4065922cc5f53bda /fs/ceph/caps.c
parent3e1d0452edceebb903d23db53201013c940bf000 (diff)
ceph: fix error handling in ceph_get_caps()
The function return 0 even when interrupted or try_get_cap_refs() return error. Fixes: 1199d7da2d ("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>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 52a2b90621cd..0176241eaea7 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2738,15 +2738,13 @@ int ceph_get_caps(struct ceph_inode_info *ci, int need, int want,
2738 _got = 0; 2738 _got = 0;
2739 ret = try_get_cap_refs(ci, need, want, endoff, 2739 ret = try_get_cap_refs(ci, need, want, endoff,
2740 false, &_got); 2740 false, &_got);
2741 if (ret == -EAGAIN) { 2741 if (ret == -EAGAIN)
2742 continue; 2742 continue;
2743 } else if (!ret) { 2743 if (!ret) {
2744 int err;
2745
2746 DEFINE_WAIT_FUNC(wait, woken_wake_function); 2744 DEFINE_WAIT_FUNC(wait, woken_wake_function);
2747 add_wait_queue(&ci->i_cap_wq, &wait); 2745 add_wait_queue(&ci->i_cap_wq, &wait);
2748 2746
2749 while (!(err = try_get_cap_refs(ci, need, want, endoff, 2747 while (!(ret = try_get_cap_refs(ci, need, want, endoff,
2750 true, &_got))) { 2748 true, &_got))) {
2751 if (signal_pending(current)) { 2749 if (signal_pending(current)) {
2752 ret = -ERESTARTSYS; 2750 ret = -ERESTARTSYS;
@@ -2756,14 +2754,16 @@ int ceph_get_caps(struct ceph_inode_info *ci, int need, int want,
2756 } 2754 }
2757 2755
2758 remove_wait_queue(&ci->i_cap_wq, &wait); 2756 remove_wait_queue(&ci->i_cap_wq, &wait);
2759 if (err == -EAGAIN) 2757 if (ret == -EAGAIN)
2760 continue; 2758 continue;
2761 } 2759 }
2762 if (ret == -ESTALE) { 2760 if (ret < 0) {
2763 /* session was killed, try renew caps */ 2761 if (ret == -ESTALE) {
2764 ret = ceph_renew_caps(&ci->vfs_inode); 2762 /* session was killed, try renew caps */
2765 if (ret == 0) 2763 ret = ceph_renew_caps(&ci->vfs_inode);
2766 continue; 2764 if (ret == 0)
2765 continue;
2766 }
2767 return ret; 2767 return ret;
2768 } 2768 }
2769 2769