Message ID | 20241014110304.60746-1-qianqiang.liu@163.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ceph: return result directly from wait_for_completion_killable() | expand |
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 --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)
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(-)