From 9216f92eb10f60dc45929b2807b387f9edfaf535 Mon Sep 17 00:00:00 2001 From: Matteo Croce Date: Mar 03 2025 18:31:26 +0000 Subject: backport "Remove flock() usage from READ4_PCI() WRITE4_PCI() macros" Backport fix from https://github.com/Mellanox/mstflint/pull/1126 --- diff --git a/flock.patch b/flock.patch new file mode 100644 index 0000000..fbeeda2 --- /dev/null +++ b/flock.patch @@ -0,0 +1,60 @@ +From 963895584a99f3fc8a506a6ab65b9a0ffad6477c Mon Sep 17 00:00:00 2001 +From: oburstein +Date: Wed, 29 Jan 2025 16:33:52 +0200 +Subject: [PATCH] [mtcr_ul] Remove flock() usage from READ4_PCI() WRITE4_PCI() + macros no need for this semaphore as we rely on the VSC's semaphore. + +--- + mtcr_ul/mtcr_ul_com.c | 28 ---------------------------- + 1 file changed, 28 deletions(-) + +diff --git a/mtcr_ul/mtcr_ul_com.c b/mtcr_ul/mtcr_ul_com.c +index d37b64f7..77d2f19a 100644 +--- a/mtcr_ul/mtcr_ul_com.c ++++ b/mtcr_ul/mtcr_ul_com.c +@@ -712,21 +712,7 @@ enum { + do \ + { \ + int rc; \ +- int lock_rc; \ +- ul_ctx_t* pci_ctx = mf->ul_ctx; \ +- lock_rc = _flock_int(pci_ctx->fdlock, LOCK_EX); \ +- if (lock_rc) \ +- { \ +- perror(err_prefix); \ +- action_on_fail; \ +- } \ + rc = pread(mf->fd, val_ptr, 4, pci_offs); \ +- lock_rc = _flock_int(pci_ctx->fdlock, LOCK_UN); \ +- if (lock_rc) \ +- { \ +- perror(err_prefix); \ +- action_on_fail; \ +- } \ + if (rc != 4) \ + { \ + if (rc < 0) \ +@@ -742,23 +728,9 @@ enum { + do \ + { \ + int rc; \ +- int lock_rc; \ + u_int32_t val_le; \ +- ul_ctx_t* pci_ctx = mf->ul_ctx; \ + val_le = __cpu_to_le32(val); \ +- lock_rc = _flock_int(pci_ctx->fdlock, LOCK_EX); \ +- if (lock_rc) \ +- { \ +- perror(err_prefix); \ +- action_on_fail; \ +- } \ + rc = pwrite(mf->fd, &val_le, 4, pci_offs); \ +- lock_rc = _flock_int(pci_ctx->fdlock, LOCK_UN); \ +- if (lock_rc) \ +- { \ +- perror(err_prefix); \ +- action_on_fail; \ +- } \ + if (rc != 4) \ + { \ + if (rc < 0) \ diff --git a/mstflint.spec b/mstflint.spec index 666e361..0be92d7 100644 --- a/mstflint.spec +++ b/mstflint.spec @@ -14,7 +14,8 @@ Source0: https://github.com/Mellanox/%{name}/releases/download/v%{version}-1/%{ Group: Applications/System Patch1: 0001-Fix-bind-now-test.patch -Patch4: add-default-link-flags-for-shared-libraries.patch +Patch4: add-default-link-flags-for-shared-libraries.patch +Patch5: https://github.com/Mellanox/mstflint/commit/963895584a99f3fc8a506a6ab65b9a0ffad6477c.patch#/flock.patch BuildRequires: make BuildRequires: libstdc++-devel, zlib-devel, libibmad-devel, gcc-c++, gcc @@ -34,8 +35,9 @@ for network adapters based on Mellanox Technologies chips. %prep %setup -q -n %{name}-%{version} -%patch1 -p1 -%patch4 -p1 +%patch -P1 -p1 +%patch -P4 -p1 +%patch -P5 -p1 find . -type f -iname '*.[ch]' -exec chmod a-x '{}' ';' find . -type f -iname '*.cpp' -exec chmod a-x '{}' ';'