diff mbox series

ceph: return result directly from wait_for_completion_killable()

Message ID 20241014110304.60746-1-qianqiang.liu@163.com
State New
Headers show
Series ceph: return result directly from wait_for_completion_killable() | expand

Commit Message

Qianqiang Liu Oct. 14, 2024, 11:03 a.m. UTC
Simplify the code by returning the result of
wait_for_completion_killable() directly, instead of calling it
separately and then returning 0.

No functional changes are introduced, this is a simple refactor
to streamline the code.

Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
---
 fs/ceph/locks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ilya Dryomov Oct. 27, 2024, 7:47 p.m. UTC | #1
On Mon, Oct 14, 2024 at 1:40 PM Qianqiang Liu <qianqiang.liu@163.com> wrote:
>
> Simplify the code by returning the result of
> wait_for_completion_killable() directly, instead of calling it
> separately and then returning 0.
>
> No functional changes are introduced, this is a simple refactor

Hi Qianqiang,

I don't think this statement is true.  If the wait is interrupted,
wait_for_completion_killable() returns -ERESTARTSYS and currently
ceph_lock_wait_for_completion() swallows it, similar to how -ERESTARTSYS
coming from ceph_mdsc_do_request() is ignored a few lines above.

Thanks,

                Ilya
diff mbox series

Patch

diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index ebf4ac0055dd..0d48a85f5397 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -221,8 +221,7 @@  static int ceph_lock_wait_for_completion(struct ceph_mds_client *mdsc,
 	if (err && err != -ERESTARTSYS)
 		return err;
 
-	wait_for_completion_killable(&req->r_safe_completion);
-	return 0;
+	return wait_for_completion_killable(&req->r_safe_completion);
 }
 
 static int try_unlock_file(struct file *file, struct file_lock *fl)