From 20a276c945da3b1a479d3b9c06ae755cbae64133 Mon Sep 17 00:00:00 2001 From: "Paul H. Hargrove" Date: Thu, 9 Mar 2017 02:55:24 +0700 Subject: [PATCH 1/3] opal/pmix112: dstore/sm: added the check `posix_fallocate` return code Signed-off-by: Paul H. Hargrove (cherry picked from commit on PMIx v1.2 branch pmix/pmix@14f865c) --- opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c b/opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c index 065e0f8f951..0f6a4e1e840 100644 --- a/opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c +++ b/opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c @@ -64,15 +64,31 @@ int _mmap_segment_create(pmix_sm_seg_t *sm_seg, const char *file_name, size_t si } /* size backing file - note the use of real_size here */ #ifdef HAVE_POSIX_FALLOCATE - if (0 != posix_fallocate(sm_seg->seg_id, 0, size)) { + if (0 != (rc = posix_fallocate(sm_seg->seg_id, 0, size))) { pmix_output_verbose(2, pmix_globals.debug_output, "sys call posix_fallocate(2) fail\n"); - if (ENOSPC == errno) { + if ((ENOTSUP == rc) +#ifdef EOPNOTSUPP + || (EOPNOTSUPP == rc) +#endif + ) { + /* Not supported by OS and/or filesystem. + * Must fall-back to ftruncate(). + */ + if (0 != ftruncate(sm_seg->seg_id, size)) { + pmix_output_verbose(2, pmix_globals.debug_output, + "sys call ftruncate(2) fail\n"); + rc = PMIX_ERROR; + goto out; + } + rc = PMIX_SUCCESS; + } else if (ENOSPC == rc) { rc = PMIX_ERR_OUT_OF_RESOURCE; + goto out; } else { rc = PMIX_ERROR; + goto out; } - goto out; } #else if (0 != ftruncate(sm_seg->seg_id, size)) { From af4f0eb028355ef92eb1829c9015f7e0953d2c20 Mon Sep 17 00:00:00 2001 From: Boris Karasev Date: Thu, 9 Mar 2017 02:59:13 +0700 Subject: [PATCH 2/3] pmix/pmix112: dstore/sm: small refactoring of `posix_fallocate` check ret code. This refactoring to avoid duplication of code (cherry picked from commit on PMIx v1.2 branch pmix/pmix@1b86a6e) Signed-off-by: Boris Karasev --- opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c b/opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c index 0f6a4e1e840..72f44fddc27 100644 --- a/opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c +++ b/opal/mca/pmix/pmix112/pmix/src/sm/pmix_mmap.c @@ -67,37 +67,35 @@ int _mmap_segment_create(pmix_sm_seg_t *sm_seg, const char *file_name, size_t si if (0 != (rc = posix_fallocate(sm_seg->seg_id, 0, size))) { pmix_output_verbose(2, pmix_globals.debug_output, "sys call posix_fallocate(2) fail\n"); - if ((ENOTSUP == rc) -#ifdef EOPNOTSUPP - || (EOPNOTSUPP == rc) -#endif - ) { - /* Not supported by OS and/or filesystem. - * Must fall-back to ftruncate(). - */ - if (0 != ftruncate(sm_seg->seg_id, size)) { - pmix_output_verbose(2, pmix_globals.debug_output, - "sys call ftruncate(2) fail\n"); - rc = PMIX_ERROR; - goto out; - } - rc = PMIX_SUCCESS; - } else if (ENOSPC == rc) { + if (ENOSPC == rc) { rc = PMIX_ERR_OUT_OF_RESOURCE; goto out; - } else { + } else if ((ENOTSUP != rc) +#ifdef EOPNOTSUPP + && (EOPNOTSUPP != rc) +#endif + ){ rc = PMIX_ERROR; goto out; } + /* else: + * Not supported by OS and/or filesystem. + * Must fall-back to ftruncate(). + */ + } else { + goto map_memory; } -#else +#endif if (0 != ftruncate(sm_seg->seg_id, size)) { pmix_output_verbose(2, pmix_globals.debug_output, "sys call ftruncate(2) fail\n"); rc = PMIX_ERROR; goto out; + } else { + rc = PMIX_SUCCESS; } -#endif + +map_memory: if (MAP_FAILED == (seg_addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sm_seg->seg_id, 0))) { From f4511f9d9b2d8946fab029452bead4bd6a1347d8 Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Thu, 9 Mar 2017 03:01:35 +0700 Subject: [PATCH 3/3] pmix/pmix112: Update README with two more v1.2.2 cherry-pick Signed-off-by: Artem Polyakov --- opal/mca/pmix/pmix112/README | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opal/mca/pmix/pmix112/README b/opal/mca/pmix/pmix112/README index ddb90a16e9f..472cd8294b9 100644 --- a/opal/mca/pmix/pmix112/README +++ b/opal/mca/pmix/pmix112/README @@ -6,10 +6,12 @@ Additional copyrights may follow $HEADER$ =========================================================================== -This internal component includes PMIx v1.2.1 plus these two commits +This internal component includes PMIx v1.2.1 plus following commits cherry-picked from the PMIx v1.2 branch (which will be included in the eventual PMIx v1.2.2 release). Newer patches at top. + * https://github.com/pmix/pmix/commit/1b86a6e7ee99fc5969a0789a9905a4a2159a6dc0 + * https://github.com/pmix/pmix/commit/14f865c4b631827fb99779d42eaf0567f117a76f * https://github.com/pmix/pmix/commit/4269e8484bd883523ae485bf2e1b7bbc0719c494 * https://github.com/pmix/pmix/commit/a2d431cbec162b01e15920cc75df1af9ad244f06 * https://github.com/pmix/pmix/commit/8587f278a17301633ccf6f0d7cb086e3be8f4793