From: John L. Hammond Date: Wed, 14 Feb 2024 08:39:27 +0000 (-0800) Subject: LU-14047 lustre: change EWOULDBLOCK to EAGAIN X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=8909e5a09428da7e72609501dbd33cb4dd534528;p=fs%2Flustre-release.git LU-14047 lustre: change EWOULDBLOCK to EAGAIN On linux, EWOULDBLOCK has always been defined as an alias for EAGAIN. In the interest of readability we should not use two names for the same thing. So change the remaining uses of EWOULDBLOCK to EAGAIN and add EWOULDBLOCK||EAGAIN to spelling.txt. Lustre-change: https://review.whamcloud.com/40307 Lustre-commit: a7f48e6c15e28617793d89958c79e9ed8cb73e65 Signed-off-by: John L. Hammond Change-Id: Ib48b8a1e58bfa961d2a4ba411c038c476bfc300d Reviewed-by: Yingjin Qian Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54030 Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/doc/llapi_hsm_copytool_register.3 b/lustre/doc/llapi_hsm_copytool_register.3 index 22e5047..01dee2a 100644 --- a/lustre/doc/llapi_hsm_copytool_register.3 +++ b/lustre/doc/llapi_hsm_copytool_register.3 @@ -125,7 +125,7 @@ with the register copytool. On error, a negative errno is returned. .UNINDENT .sp \fBllapi_hsm_copytool_recv\fP returns 0 when a message is available. If -the copytool was set to non\-blocking operation, \-EWOULDBLOCK is +the copytool was set to non\-blocking operation, \-EAGAIN is immediately returned if no message is available. On error, a negative errno is returned. .SH ERRORS @@ -139,7 +139,7 @@ registered, ... .sp \fB\-EPROTO\fP Lustre protocol error. .sp -\fB\-EWOULDBLOCK\fP No HSM message is available, and the copytool was set +\fB\-EAGAIN\fP No HSM message is available, and the copytool was set to not block on receives. .SH SEE ALSO .sp diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index cd360d7..2855eb6 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -386,7 +386,7 @@ int fld_client_rpc(struct obd_export *exp, if (OBD_FAIL_CHECK(OBD_FAIL_FLD_QUERY_REQ && req->rq_no_delay)) { /* the same error returned by ptlrpc_import_delay_req */ - rc = -EWOULDBLOCK; + rc = -EAGAIN; req->rq_status = rc; } else { obd_get_request_slot(&exp->exp_obd->u.cli); diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index f7306bc..90a3d18 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -1666,11 +1666,11 @@ struct cl_io_operations { * \ingroup cl_lock */ enum cl_enq_flags { - /** - * instruct server to not block, if conflicting lock is found. Instead - * -EWOULDBLOCK is returned immediately. - */ - CEF_NONBLOCK = 0x00000001, + /** + * instruct server to not block, if conflicting lock is found. Instead + * -EAGAIN is returned immediately. + */ + CEF_NONBLOCK = 0x00000001, /** * Tell lower layers this is a glimpse request, translated to * LDLM_FL_HAS_INTENT at LDLM layer. diff --git a/lustre/ldlm/ldlm_extent.c b/lustre/ldlm/ldlm_extent.c index 993193a..6f38ef2 100644 --- a/lustre/ldlm/ldlm_extent.c +++ b/lustre/ldlm/ldlm_extent.c @@ -380,7 +380,7 @@ static enum interval_iter ldlm_extent_compat_cb(struct interval_node *n, * \retval 1 if the lock is compatible * \retval 2 if \a req is a group lock and it is compatible and requires * no further checking - * \retval negative error, such as EWOULDBLOCK for group locks + * \retval negative error, such as EAGAIN for group locks */ static int ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req, @@ -434,7 +434,7 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req, if (tree->lit_mode == LCK_GROUP) { if (*flags & (LDLM_FL_BLOCK_NOWAIT | LDLM_FL_SPECULATIVE)) { - compat = -EWOULDBLOCK; + compat = -EAGAIN; goto destroylock; } @@ -463,7 +463,7 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req, if (!work_list) { RETURN(0); } else { - compat = -EWOULDBLOCK; + compat = -EAGAIN; goto destroylock; } } @@ -537,7 +537,7 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req, * immediately */ if (*flags & (LDLM_FL_BLOCK_NOWAIT | LDLM_FL_SPECULATIVE)) { - compat = -EWOULDBLOCK; + compat = -EAGAIN; goto destroylock; } /* If this group lock is compatible with another @@ -577,7 +577,7 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req, * range does not matter */ if (*flags & (LDLM_FL_BLOCK_NOWAIT | LDLM_FL_SPECULATIVE)) { - compat = -EWOULDBLOCK; + compat = -EAGAIN; goto destroylock; } } else if (lock->l_policy_data.l_extent.end < req_start || @@ -594,7 +594,7 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req, RETURN(0); if (*flags & LDLM_FL_SPECULATIVE) { - compat = -EWOULDBLOCK; + compat = -EAGAIN; goto destroylock; } @@ -755,9 +755,9 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, __u64 *flags, *err = ELDLM_OK; if (intention == LDLM_PROCESS_RESCAN) { - /* Careful observers will note that we don't handle -EWOULDBLOCK + /* Careful observers will note that we don't handle -EAGAIN * here, but it's ok for a non-obvious reason -- compat_queue - * can only return -EWOULDBLOCK if (flags & BLOCK_NOWAIT | + * can only return -EAGAIN if (flags & BLOCK_NOWAIT | * SPECULATIVE). flags should always be zero here, and if that * ever stops being true, we want to find out. */ LASSERT(*flags == 0); diff --git a/lustre/llite/glimpse.c b/lustre/llite/glimpse.c index 937a891..5ed6df2 100644 --- a/lustre/llite/glimpse.c +++ b/lustre/llite/glimpse.c @@ -215,7 +215,7 @@ int cl_glimpse_size0(struct inode *inode, int agl) * need to limit retries for FLR mirrors if fast read * is short because of concurrent truncate. */ - if (!agl && result == -EWOULDBLOCK && + if (!agl && result == -EAGAIN && !io->ci_tried_all_mirrors) io->ci_need_restart = 1; } diff --git a/lustre/llite/vvp_page.c b/lustre/llite/vvp_page.c index 484f78d..84c3259 100644 --- a/lustre/llite/vvp_page.c +++ b/lustre/llite/vvp_page.c @@ -290,7 +290,7 @@ static void vvp_page_completion_read(const struct lu_env *env, cl_page_export(env, page, 1); } else if (vpg->vpg_defer_uptodate) { vpg->vpg_defer_uptodate = 0; - if (ioret == -EWOULDBLOCK) { + if (ioret == -EAGAIN) { /* mirror read failed, it needs to destroy the page * because subpage would be from wrong osc when trying * to read from a new mirror diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index 3ac7e7d..67f5d20 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -789,7 +789,7 @@ int cl_io_loop(const struct lu_env *env, struct cl_io *io) if (rc && !result) result = rc; - if (result == -EWOULDBLOCK && io->ci_ndelay && + if (result == -EAGAIN && io->ci_ndelay && !io->ci_iocb_nowait) { io->ci_need_restart = 1; result = 0; diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index d03e3d4..6330f35 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -413,7 +413,7 @@ int osc_io_iter_init(const struct lu_env *env, const struct cl_io_slice *ios) */ if (ios->cis_io->ci_type == CIT_READ && ios->cis_io->ci_ndelay && !ios->cis_io->ci_tried_all_mirrors && osc_import_not_healthy(imp)) { - rc = -EWOULDBLOCK; + rc = -EAGAIN; } else if (likely(!imp->imp_invalid)) { atomic_inc(&osc->oo_nr_ios); oio->oi_is_active = 1; diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index 1b33501..f411022 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -298,7 +298,7 @@ static int osc_lock_upcall(void *cookie, struct lustre_handle *lockh, /* Hide the error. */ rc = 0; } else if (rc < 0 && oscl->ols_flags & LDLM_FL_NDELAY) { - rc = -EWOULDBLOCK; + rc = -EAGAIN; } if (oscl->ols_owner != NULL) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index ccd60da..76f6a79 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2779,7 +2779,7 @@ static int brw_interpret(const struct lu_env *env, list_for_each_entry_safe(ext, tmp, &aa->aa_exts, oe_link) { list_del_init(&ext->oe_link); osc_extent_finish(env, ext, 1, - rc && req->rq_no_delay ? -EWOULDBLOCK : rc); + rc && req->rq_no_delay ? -EAGAIN : rc); } LASSERT(list_empty(&aa->aa_exts)); LASSERT(list_empty(&aa->aa_oaps)); diff --git a/lustre/osp/osp_precreate.c b/lustre/osp/osp_precreate.c index 6839801..ac8439c 100644 --- a/lustre/osp/osp_precreate.c +++ b/lustre/osp/osp_precreate.c @@ -1685,12 +1685,12 @@ int osp_object_truncate(const struct lu_env *env, struct dt_object *dt, * XXX: decide how do we do here with resend * if we don't resend, then client may see wrong file size * if we do resend, then MDS thread can get stuck for quite long - * and if we don't resend, then client will also get -EWOULDBLOCK !! + * and if we don't resend, then client will also get -EAGAIN !! * (see LU-7975 and sanity/test_27F use cases) * but let's decide not to resend/delay this truncate request to OST * and allow Client to decide to resend, in a less agressive way from * after_reply(), by returning -EINPROGRESS instead of - * -EAGAIN/-EWOULDBLOCK upon return from ptlrpc_queue_wait() at the + * -EAGAIN/-EAGAIN upon return from ptlrpc_queue_wait() at the * end of this routine */ req->rq_no_resend = req->rq_no_delay = 1; @@ -1720,14 +1720,14 @@ int osp_object_truncate(const struct lu_env *env, struct dt_object *dt, rc = ptlrpc_queue_wait(req); if (rc) { - /* -EWOULDBLOCK/-EAGAIN means OST is unreachable at the moment + /* -EAGAIN/-EWOULDBLOCK means OST is unreachable at the moment * since we have decided not to resend/delay, but this could * lead to wrong size to be seen at Client side and even process * trying to open to exit/fail if not itself handling -EAGAIN. * So it should be better to return -EINPROGRESS instead and * leave the decision to resend at Client side in after_reply() */ - if (rc == -EWOULDBLOCK) { + if (rc == -EAGAIN) { rc = -EINPROGRESS; CDEBUG(D_HA, "returning -EINPROGRESS instead of " "-EWOULDBLOCK/-EAGAIN to allow Client to " diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index ab56bc5..cce7035 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -1295,7 +1295,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, } else if (req->rq_no_delay && imp->imp_generation != imp->imp_initiated_at) { /* ignore nodelay for requests initiating connections */ - *status = -EWOULDBLOCK; + *status = -EAGAIN; } else if (req->rq_allow_replay && (imp->imp_state == LUSTRE_IMP_REPLAY || imp->imp_state == LUSTRE_IMP_REPLAY_LOCKS || diff --git a/lustre/ptlrpc/errno.c b/lustre/ptlrpc/errno.c index a3d31a8..987803b 100644 --- a/lustre/ptlrpc/errno.c +++ b/lustre/ptlrpc/errno.c @@ -35,8 +35,8 @@ * The two translation tables below must define a one-to-one mapping between * host and network errnos. * - * EWOULDBLOCK is equal to EAGAIN on all architectures except for parisc, which - * appears irrelevant. Thus, existing references to EWOULDBLOCK are fine. + * EAGAIN is equal to EAGAIN on all architectures except for parisc, which + * appears irrelevant. Thus, existing references to EAGAIN are fine. * * EDEADLOCK is equal to EDEADLK on x86 but not on sparc, at least. A sparc * host has no context-free way to determine if a LUSTRE_EDEADLK represents an diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index e5d2178..fe512da 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -790,7 +790,7 @@ again: spin_unlock(&ctx->cc_lock); if (timeout == 0) - RETURN(-EWOULDBLOCK); + RETURN(-EAGAIN); /* Clear any flags that may be present from previous sends */ LASSERT(req->rq_receiving_reply == 0); diff --git a/lustre/tests/llapi_hsm_test.c b/lustre/tests/llapi_hsm_test.c index 01a701c..32998af 100644 --- a/lustre/tests/llapi_hsm_test.c +++ b/lustre/tests/llapi_hsm_test.c @@ -201,7 +201,7 @@ int test5(void) /* Hopefully there is nothing lingering */ for (i = 0; i < 1000; i++) { rc = llapi_hsm_copytool_recv(ctdata, &hal, &msgsize); - ASSERTF(rc == -EWOULDBLOCK, "llapi_hsm_copytool_recv error: %s", + ASSERTF(rc == -EAGAIN, "llapi_hsm_copytool_recv error: %s", strerror(-rc)); } @@ -272,7 +272,7 @@ int test7(void) rc, strerror(errno)); rc = llapi_hsm_copytool_recv(ctdata, &hal, &msgsize); - ASSERTF(rc == -EWOULDBLOCK, "llapi_hsm_copytool_recv error: %s", + ASSERTF(rc == -EAGAIN, "llapi_hsm_copytool_recv error: %s", strerror(-rc)); fds[0].fd = fd; diff --git a/lustre/tests/mpi/parallel_grouplock.c b/lustre/tests/mpi/parallel_grouplock.c index dfddd4f..1ece6e2 100644 --- a/lustre/tests/mpi/parallel_grouplock.c +++ b/lustre/tests/mpi/parallel_grouplock.c @@ -616,9 +616,9 @@ void grouplock_test4(char *filename, int fd) /* * task0 attempts GR(gid=1) -- granted - * task1 attempts PR on non-blocking fd -> should return -EWOULDBLOCK - * task2 attempts PW on non-blocking fd -> should return -EWOULDBLOCK - * task3 attempts GR(gid=2) on non-blocking fd -> should return -EWOULDBLOCK + * task1 attempts PR on non-blocking fd -> should return -EAGAIN + * task2 attempts PW on non-blocking fd -> should return -EAGAIN + * task3 attempts GR(gid=2) on non-blocking fd -> should return -EAGAIN */ void grouplock_nonblock_test(char *filename, int fd) { @@ -643,14 +643,14 @@ void grouplock_nonblock_test(char *filename, int fd) switch (rank) { case 1: rc = read(fd, buf, sizeof(buf)); - if ((rc != -1) || (errno != EWOULDBLOCK)) + if ((rc != -1) || (errno != EAGAIN)) FAIL("PR lock succeeded while incompatible GROUP LOCK (gid=1) is still held\n"); MPI_Send(&gid, 1, MPI_INT, 0, 1, MPI_COMM_WORLD); break; case 2: rc = write(fd, buf, sizeof(buf)); - if ((rc != -1) || (errno != EWOULDBLOCK)) + if ((rc != -1) || (errno != EAGAIN)) FAIL("PW lock succeeded while incompatible GROUP LOCK (gid=1) is still held\n"); MPI_Send(&gid, 1, MPI_INT, 0, 1, MPI_COMM_WORLD); @@ -658,7 +658,7 @@ void grouplock_nonblock_test(char *filename, int fd) case 3: gid = 2; rc = ioctl(fd, LL_IOC_GROUP_LOCK, gid); - if ((rc != -1) || (errno != EWOULDBLOCK)) + if ((rc != -1) || (errno != EAGAIN)) FAIL("GROUP_LOCK (gid=2) succeeded while incompatible GROUP LOCK (gid=1) is still held.\n"); MPI_Send(&gid, 1, MPI_INT, 0, 1, MPI_COMM_WORLD);