diff --git a/.gitignore b/.gitignore
index 91934d6..7163ca1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/openmpi-4.0.5.tar.bz2
+SOURCES/openmpi-4.1.1.tar.bz2
diff --git a/.openmpi.metadata b/.openmpi.metadata
index f532325..2f44671 100644
--- a/.openmpi.metadata
+++ b/.openmpi.metadata
@@ -1 +1 @@
-01fba71461dd0c89e191e3bf1eb70e832d1aa5db SOURCES/openmpi-4.0.5.tar.bz2
+fa4dc97da18c8c26d5aadb85262a0f2d52b1aa90 SOURCES/openmpi-4.1.1.tar.bz2
diff --git a/SOURCES/macros.openmpi b/SOURCES/macros.openmpi
index 05e613f..1ee6a3c 100644
--- a/SOURCES/macros.openmpi
+++ b/SOURCES/macros.openmpi
@@ -1,6 +1,7 @@
 %_openmpi_load \
  . /etc/profile.d/modules.sh; \
- module load mpi/openmpi-%{_arch};
+ module load mpi/openmpi-%{_arch}; \
+ export OMPI_MCA_rmaps_base_oversubscribe=1
 %_openmpi_unload \
  . /etc/profile.d/modules.sh; \
  module unload mpi/openmpi-%{_arch};
diff --git a/SOURCES/openmpi.module.in b/SOURCES/openmpi.module.in
index 287a4b5..41583c4 100644
--- a/SOURCES/openmpi.module.in
+++ b/SOURCES/openmpi.module.in
@@ -13,9 +13,9 @@ setenv			MPI_FORTRAN_MOD_DIR	@FMODDIR@
 setenv			MPI_INCLUDE	@INCDIR@
 setenv	 		MPI_LIB		@LIBDIR@/lib
 setenv			MPI_MAN		@MANDIR@
-setenv			MPI_PYTHON_SITEARCH	@PYSITEARCH@
-setenv			MPI_PYTHON2_SITEARCH	@PYSITEARCH@
-setenv			MPI_PYTHON3_SITEARCH	@PYSITEARCH@
+setenv			MPI_PYTHON_SITEARCH	@PY2SITEARCH@
+setenv			MPI_PYTHON2_SITEARCH	@PY2SITEARCH@
+setenv			MPI_PYTHON3_SITEARCH	@PY3SITEARCH@
 setenv			MPI_COMPILER	@COMPILER@
 setenv			MPI_SUFFIX	@SUFFIX@
 setenv	 		MPI_HOME	@LIBDIR@
diff --git a/SOURCES/openmpi.pth.py2 b/SOURCES/openmpi.pth.py2
new file mode 100644
index 0000000..a2dc353
--- /dev/null
+++ b/SOURCES/openmpi.pth.py2
@@ -0,0 +1 @@
+import sys, os; s = os.getenv('MPI_PYTHON2_SITEARCH'); s and (s in sys.path or sys.path.append(s))
diff --git a/SPECS/openmpi.spec b/SPECS/openmpi.spec
index 500e23f..6404cc4 100644
--- a/SPECS/openmpi.spec
+++ b/SPECS/openmpi.spec
@@ -1,18 +1,3 @@
-%global _hardened_build 1
-# We only compile with gcc, but other people may want other compilers.
-# Set the compiler here.
-%global opt_cc gcc
-# Optional CFLAGS to use with the specific compiler...gcc doesn't need any,
-# so uncomment and define to use
-#global opt_cflags
-%global opt_cxx g++
-#global opt_cxxflags
-%global opt_f77 gfortran
-#global opt_fflags
-%global opt_fc gfortran
-#global opt_fcflags
-
-
 # Optional name suffix to use...we leave it off when compiling with gcc, but
 # for other compiled versions to install side by side, it will need a
 # suffix in order to keep the names from conflicting.
@@ -20,60 +5,97 @@
 
 %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
 
-Name:			openmpi%{?_cc_name_suffix}
-Version:		4.0.5
-Release:		3%{?dist}
-Summary:		Open Message Passing Interface
-Group:			Development/Libraries
-License:		BSD and MIT and Romio
-URL:			http://www.open-mpi.org/
+%if 0%{?fedora} >= 32 || 0%{?rhel} >= 8
+%bcond_with python2
+%else
+%bcond_without python2
+%endif
 
-# We can't use %%{name} here because of _cc_name_suffix
-Source0:		https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-%{version}.tar.bz2
-Source1:		openmpi.module.in
-Source2:		openmpi.pth.py3
-Source3:		macros.openmpi
+%ifarch aarch64 ppc64le x86_64
+%bcond_without ucx
+%else
+%bcond_with ucx
+%endif
 
-BuildRequires:		gcc-gfortran, gcc-c++
-%ifnarch s390 s390x
-BuildRequires:		valgrind-devel
+# ARM 32-bit is not supported by rdma
+# https://bugzilla.redhat.com/show_bug.cgi?id=1780584
+%ifarch %{arm}
+%bcond_with rdma
+%else
+%bcond_without rdma
 %endif
-%ifnarch s390 s390x i686
-BuildRequires:		ucx-devel
+
+# Run autogen - needed for some patches
+%bcond_with autogen
+
+Name:           openmpi%{?_cc_name_suffix}
+Version:        4.1.1
+Release:        1%{?dist}
+Summary:        Open Message Passing Interface
+License:        BSD and MIT and Romio
+URL:            http://www.open-mpi.org/
+
+# We can't use %%{name} here because of _cc_name_suffix
+Source0:        https://www.open-mpi.org/software/ompi/v4.1/downloads/openmpi-%{version}.tar.bz2
+Source1:        openmpi.module.in
+Source2:        openmpi.pth.py2
+Source3:        openmpi.pth.py3
+Source4:        macros.openmpi
+
+BuildRequires:  gcc-c++
+BuildRequires:  gcc-gfortran
+BuildRequires:  make
+%if %{with autogen}
+BuildRequires:  libtool
+BuildRequires:  perl(Data::Dumper)
+BuildRequires:  perl(File::Find)
 %endif
-%ifnarch s390 s390x %{arm}
-BuildRequires:		libibverbs-devel >= 1.1.3, opensm-devel >= 3.3.22
-BuildRequires:		librdmacm-devel rdma-core-devel
+BuildRequires:  valgrind-devel
+%if %{with rdma}
+BuildRequires:  opensm-devel > 3.3.0
+BuildRequires:  rdma-core-devel
 %endif
 # Doesn't compile:
 # vt_dyn.cc:958:28: error: 'class BPatch_basicBlockLoop' has no member named 'getLoopHead'
 #                      loop->getLoopHead()->getStartAddress(), loop_stmts );
-#BuildRequires:		dyninst-devel
-BuildRequires:		hwloc-devel >= 2.2.0
+#BuildRequires:  dyninst-devel
+BuildRequires:  hwloc-devel >= 2.2.0
 # So configure can find lstopo
-BuildRequires:		hwloc-gui
-BuildRequires:		java-devel
+BuildRequires:  hwloc-gui
+BuildRequires:  java-devel
+# Old libevent causes issues
+%if !0%{?el7}
+BuildRequires:  libevent-devel
+%endif
+BuildRequires:  libfabric-devel
 %ifnarch s390 s390x
-BuildRequires:		libfabric-devel
-BuildRequires:		papi-devel
+BuildRequires:  papi-devel
 %endif
-BuildRequires:		perl-generators
-BuildRequires:		perl(Getopt::Long)
-BuildRequires:		pmix-devel
+BuildRequires:  perl-generators
+BuildRequires:  perl-interpreter
+BuildRequires:  perl(Getopt::Long)
+BuildRequires:  pmix-devel
+BuildRequires:  python%{python3_pkgversion}-devel
 %ifarch x86_64
-BuildRequires:          libpsm2-devel
+BuildRequires:  libpsm2-devel
+%endif
+%if %{with ucx}
+BuildRequires:  ucx-devel
+%endif
+BuildRequires:  zlib-devel
+%if !0%{?el7}
+BuildRequires:  rpm-mpi-hooks
 %endif
-BuildRequires:		torque-devel
-BuildRequires:		zlib-devel
-BuildRequires:		rpm-mpi-hooks
-BuildRequires:		libevent-devel >= 2.0.22
 
-Provides:		mpi
-Requires:		environment(modules)
+Provides:       mpi
+%if 0%{?rhel}
+# Need this for /etc/profile.d/modules.sh
+Requires:       environment-modules
+%endif
+Requires:       environment(modules)
 # openmpi currently requires ssh to run
 # https://svn.open-mpi.org/trac/ompi/ticket/4228
-Requires:		openssh-clients
-Requires:		libevent >= 2.0.22
+Requires:       openssh-clients
 
 # Private openmpi libraries
 %global __provides_exclude_from %{_libdir}/openmpi/lib/(lib(mca|ompi|open-(pal|rte|trace))|openmpi/).*.so
@@ -90,28 +112,31 @@ researchers. For more information, see http://www.open-mpi.org/ .
 
 %package devel
 Summary:	Development files for openmpi
-Group:		Development/Libraries
 Requires:	%{name} = %{version}-%{release}, gcc-gfortran
 Provides:	mpi-devel
+%if !0%{?el7}
 Requires:	rpm-mpi-hooks
+# Make sure this package is rebuilt with correct Python version when updating
+# Otherwise mpi.req from rpm-mpi-hooks doesn't work
+# https://bugzilla.redhat.com/show_bug.cgi?id=1705296
+Requires:	(python(abi) = %{python3_version} if python3)
+%endif
 
 %description devel
 Contains development headers and libraries for openmpi.
 
 %package java
-Summary:	Java library
-Group:		Development/Libraries
-Requires:	%{name} = %{version}-%{release}
-Requires:	java-headless
+Summary:        Java library
+Requires:       %{name} = %{version}-%{release}
+Requires:       java-headless
 
 %description java
-OpenMPI Java library.
+Java library.
 
 %package java-devel
-Summary:	Java development files for openmpi
-Group:		Development/Libraries
-Requires:	%{name}-java = %{version}-%{release}
-Requires:	java-devel
+Summary:        Java development files for openmpi
+Requires:       %{name}-java = %{version}-%{release}
+Requires:       java-devel
 
 %description java-devel
 Contains development wrapper for compiling Java with openmpi.
@@ -120,19 +145,32 @@ Contains development wrapper for compiling Java with openmpi.
 # particular package, version, compiler
 %global namearch openmpi-%{_arch}%{?_cc_name_suffix}
 
-%package -n python3-openmpi
-Summary:	OpenMPI support for Python 3
-Group:		Development/Libraries
-BuildRequires:	python3-devel
-Requires:	%{name} = %{version}-%{release}
-Provides:	python-openmpi
+%if %{with python2}
+%package -n python2-openmpi
+Summary:        OpenMPI support for Python 2
+BuildRequires:  python2-devel
+Requires:       %{name} = %{version}-%{release}
+Requires:       python(abi) = %{python2_version}
 
-%description -n python3-openmpi
+%description -n python2-openmpi
+OpenMPI support for Python 2.
+%endif
+
+%package -n python%{python3_pkgversion}-openmpi
+Summary:        OpenMPI support for Python 3
+Requires:       %{name} = %{version}-%{release}
+Requires:       python(abi) = %{python3_version}
+
+%description -n python%{python3_pkgversion}-openmpi
 OpenMPI support for Python 3.
 
 
 %prep
-%setup -q -n openmpi-%{version}
+%autosetup -p1 -n %{name}-%{version}
+%if %{with autogen}
+./autogen.pl --force
+%endif
+
 
 %build
 %set_build_flags
@@ -141,37 +179,23 @@ OpenMPI support for Python 3.
 	--includedir=%{_includedir}/%{namearch} \
 	--sysconfdir=%{_sysconfdir}/%{namearch} \
 	--disable-silent-rules \
-	--disable-builtin-atomics \
-	--enable-mpi-thread-multiple \
-%ifnarch %{power64}
+	--enable-builtin-atomics \
 	--enable-mpi-cxx \
-%endif
 	--enable-mpi-java \
-	--enable-mpi-fortran=all \
-	--enable-cxx-exceptions \
+	--enable-mpi1-compatibility \
 	--with-sge \
-%ifnarch s390 s390x
 	--with-valgrind \
 	--enable-memchecker \
-%endif
-%ifnarch s390 s390x i686
-	--with-ucx \
-	--with-ucx-libdir=%{_libdir} \
-%endif
-	--with-hwloc=external \
-	--with-pmix=external \
+	--with-hwloc=/usr \
+%if !0%{?el7}
 	--with-libevent=external \
-	CC=%{opt_cc} CXX=%{opt_cxx} FC=%{opt_fc} \
-	LDFLAGS="%{build_ldflags}" \
-	CFLAGS="%{?opt_cflags}%{!?opt_cflags:$RPM_OPT_FLAGS}" \
-	CXXFLAGS="%{?opt_cxxflags}%{!?opt_cxxflags:$RPM_OPT_FLAGS}" \
-	FCFLAGS="%{?opt_fcflags}%{!?opt_fcflags:$RPM_OPT_FLAGS}" \
-	--with-contrib-vt-flags='CXXFLAGS="-I%{_includedir}/dyninst -L%{_libdir}/dyninst"'
+	--with-pmix=external \
+%endif
 
-make %{?_smp_mflags} V=1
+%make_build V=1
 
 %install
-make install DESTDIR=%{buildroot}
+%make_install
 find %{buildroot}%{_libdir}/%{name}/lib -name \*.la | xargs rm
 find %{buildroot}%{_mandir}/%{namearch} -type f | xargs gzip -9
 ln -s mpicc.1.gz %{buildroot}%{_mandir}/%{namearch}/man1/mpiCC.1.gz
@@ -180,21 +204,26 @@ rm %{buildroot}%{_mandir}/%{namearch}/man1/mpiCC.1
 mkdir %{buildroot}%{_mandir}/%{namearch}/man{2,4,5,6,8,9,n}
 
 # Make the environment-modules file
-mkdir -p %{buildroot}%{_sysconfdir}/modulefiles/mpi
+mkdir -p %{buildroot}%{_datadir}/modulefiles/mpi
 # Since we're doing our own substitution here, use our own definitions.
 sed 's#@LIBDIR@#%{_libdir}/%{name}#;
      s#@ETCDIR@#%{_sysconfdir}/%{namearch}#;
      s#@FMODDIR@#%{_fmoddir}/%{name}#;
      s#@INCDIR@#%{_includedir}/%{namearch}#;
      s#@MANDIR@#%{_mandir}/%{namearch}#;
-     s#@PYSITEARCH@#%{python3_sitearch}/%{name}#;
+%if %{with python2}
+     s#@PY2SITEARCH@#%{python2_sitearch}/%{name}#;
+%else
+     /@PY2SITEARCH@/d;
+%endif
+     s#@PY3SITEARCH@#%{python3_sitearch}/%{name}#;
      s#@COMPILER@#openmpi-%{_arch}%{?_cc_name_suffix}#;
      s#@SUFFIX@#%{?_cc_name_suffix}_openmpi#' \
      <%{SOURCE1} \
-     >%{buildroot}%{_sysconfdir}/modulefiles/mpi/%{namearch}
+     >%{buildroot}%{_datadir}/modulefiles/mpi/%{namearch}
 
 # make the rpm config file
-install -Dpm 644 %{SOURCE3} %{buildroot}/%{macrosdir}/macros.%{namearch}
+install -Dpm 644 %{SOURCE4} %{buildroot}/%{macrosdir}/macros.%{namearch}
 
 # Link the fortran module to proper location
 mkdir -p %{buildroot}%{_fmoddir}/%{name}
@@ -215,8 +244,12 @@ sed -i -e s/-ldl// -e s/-lhwloc// \
   %{buildroot}%{_libdir}/%{name}/share/openmpi/*-wrapper-data.txt
 
 # install .pth files
+%if %{with python2}
+mkdir -p %{buildroot}/%{python2_sitearch}/%{name}
+install -pDm0644 %{SOURCE2} %{buildroot}/%{python2_sitearch}/openmpi.pth
+%endif
 mkdir -p %{buildroot}/%{python3_sitearch}/%{name}
-install -pDm0644 %{SOURCE2} %{buildroot}/%{python3_sitearch}/openmpi.pth
+install -pDm0644 %{SOURCE3} %{buildroot}/%{python3_sitearch}/openmpi.pth
 
 %check
 make check
@@ -231,33 +264,58 @@ make check
 %dir %{_mandir}/%{namearch}
 %dir %{_mandir}/%{namearch}/man*
 %config(noreplace) %{_sysconfdir}/%{namearch}/*
-%{_libdir}/%{name}/bin/*.pl
 %{_libdir}/%{name}/bin/mpi[er]*
 %{_libdir}/%{name}/bin/ompi*
 %{_libdir}/%{name}/bin/orte[-dr_]*
-%ifnarch s390 s390x i686
-%{_libdir}/%{name}/bin/osh*
-%{_libdir}/%{name}/bin/shmem*
+%if %{with ucx}
+%{_libdir}/%{name}/bin/oshmem_info
+%{_libdir}/%{name}/bin/oshrun
+%{_libdir}/%{name}/bin/shmemrun
+%endif
+%{_libdir}/%{name}/lib/*.so.40*
+%{_libdir}/%{name}/lib/libmca_common_ofi.so.10*
+%{_libdir}/%{name}/lib/libmca*.so.41*
+%{_libdir}/%{name}/lib/libmca*.so.50*
+%if 0%{?el7}
+%{_libdir}/%{name}/lib/pmix/
 %endif
-%{_libdir}/%{name}/lib/*.so.*
-%{_mandir}/%{namearch}/man1/*
-%{_mandir}/%{namearch}/man7/*
+%{_mandir}/%{namearch}/man1/mpi[er]*
+%{_mandir}/%{namearch}/man1/ompi*
+%{_mandir}/%{namearch}/man1/orte[-dr_]*
+%if %{with ucx}
+%{_mandir}/%{namearch}/man1/oshmem_info*
+%{_mandir}/%{namearch}/man1/oshrun*
+%{_mandir}/%{namearch}/man1/shmemrun*
+%endif
+%{_mandir}/%{namearch}/man7/ompi_*
+%{_mandir}/%{namearch}/man7/opal_*
+%{_mandir}/%{namearch}/man7/orte*
 %{_libdir}/%{name}/lib/openmpi/*
-%{_sysconfdir}/modulefiles/mpi/
+%{_datadir}/modulefiles/mpi/
 %dir %{_libdir}/%{name}/share
 %dir %{_libdir}/%{name}/share/openmpi
 %{_libdir}/%{name}/share/openmpi/amca-param-sets
 %{_libdir}/%{name}/share/openmpi/help*.txt
-%ifnarch s390 %{arm}
+%if %{with rdma}
 %{_libdir}/%{name}/share/openmpi/mca-btl-openib-device-params.ini
 %endif
-
+%if 0%{?el7}
+%{_libdir}/%{name}/share/pmix/
+%endif
 
 %files devel
 %dir %{_includedir}/%{namearch}
+%{_libdir}/%{name}/bin/aggregate_profile.pl
 %{_libdir}/%{name}/bin/mpi[cCf]*
 %{_libdir}/%{name}/bin/opal_*
 %{_libdir}/%{name}/bin/orte[cCf]*
+%if %{with ucx}
+%{_libdir}/%{name}/bin/osh[cCf]*
+%endif
+%{_libdir}/%{name}/bin/profile2mat.pl
+%if %{with ucx}
+%{_libdir}/%{name}/bin/shmem[cCf]*
+%endif
 %{_includedir}/%{namearch}/*
 %{_fmoddir}/%{name}/
 %{_libdir}/%{name}/lib/*.so
@@ -265,6 +323,10 @@ make check
 %{_libdir}/%{name}/lib/pkgconfig/
 %{_libdir}/pkgconfig/*.pc
 %{_mandir}/%{namearch}/man1/mpi[cCf]*
+%if %{with ucx}
+%{_mandir}/%{namearch}/man1/osh[cCf]*
+%{_mandir}/%{namearch}/man1/shmem[cCf]*
+%endif
 %{_mandir}/%{namearch}/man1/opal_*
 %{_mandir}/%{namearch}/man3/*
 %{_libdir}/%{name}/share/openmpi/openmpi-valgrind.supp
@@ -281,12 +343,23 @@ make check
 %{_libdir}/%{name}/share/doc/
 %{_mandir}/%{namearch}/man1/mpijavac.1.gz
 
-%files -n python3-openmpi
+%if %{with python2}
+%files -n python2-openmpi
+%dir %{python2_sitearch}/%{name}
+%{python2_sitearch}/openmpi.pth
+%endif
+
+%files -n python%{python3_pkgversion}-openmpi
 %dir %{python3_sitearch}/%{name}
 %{python3_sitearch}/openmpi.pth
 
 
 %changelog
+* Wed Jun 09 2021 Honggang Li <honli@redhat.com> - 4.1.1-1
+- Update to upstream v4.1.1 release
+- Sync with Fedora build
+- Resolves: rhbz#1928631, rhbz#1920801
+
 * Wed Jan 27 2021 Honggang Li <honli@redhat.com> - 4.0.5-3
 - disable gcc built-in atomics
 - Resolves: rhbz#1921262