From: James Simmons Date: Thu, 22 Aug 2013 18:11:51 +0000 (-0400) Subject: LU-3581 osc: Lustre returns EINTR from writes when SA_RESTART is set X-Git-Tag: 2.4.92~6 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=eb22854741580fe1b5e149f2065cfe713901e7be LU-3581 osc: Lustre returns EINTR from writes when SA_RESTART is set When Lustre is in a read or write system call and receives a SIGALRM, it will return EINTR if interrupted in osc_enter_cache. This prevents the system call from being restarted if SA_RESTART is set in the handler. This patch changes behavior in this location to return ERESTARTSYS when a signal arrives during the call to l_wait_event. Signed-off-by: Patrick Farrell Signed-off-by: James Simmons Change-Id: I95423c5d572974352173f3c5c94d980385bfef29 Reviewed-on: http://review.whamcloud.com/7002 Reviewed-by: Rahul Deshmukh Tested-by: Hudson Tested-by: Maloo Reviewed-by: Cory Spitz Reviewed-by: Andreas Dilger --- diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index bd7a674..8d9888f 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -1551,13 +1551,24 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, /* l_wait_event is interrupted by signal, or timed out */ if (rc < 0) { - if (rc == -ETIMEDOUT) { + switch (rc) { + case -ETIMEDOUT: OSC_DUMP_GRANT(D_ERROR, cli, "try to reserve %d.\n", bytes); osc_extent_tree_dump(D_ERROR, osc); rc = -EDQUOT; + break; + case -EINTR: + /* Ensures restartability - LU-3581 */ + rc = -ERESTARTSYS; + break; + default: + CDEBUG(D_CACHE, "%s: event for cache space @" + " %p never arrived due to %d\n", + cli->cl_import->imp_obd->obd_name, + &ocw, rc); + break; } - cfs_list_del_init(&ocw.ocw_entry); GOTO(out, rc); }