summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2021-07-29 12:49:38 -0700
committerGitHub <noreply@github.com>2021-07-29 12:49:38 -0700
commit2a8f9d81d0d6b5094c3fe9c686e2afb2ec27058a (patch)
tree4e0ac437820518b59d3d957c51941e43cfb65aeb
parent7970603e5210a8c062534bd2d6a1e06166d8f010 (diff)
parent72949ef68220c47e0accfd9630d036c0473a5209 (diff)
downloadopen-iscsi-2a8f9d81d0d6b5094c3fe9c686e2afb2ec27058a.tar.gz
Merge pull request #270 from mikechristie/prctl-flusher-support
iscsid: set PR_SET_IO_FLUSHER
-rw-r--r--usr/iscsid.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/usr/iscsid.c b/usr/iscsid.c
index dc54fec..478c83d 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -34,6 +34,7 @@
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/prctl.h>
#ifndef NO_SYSTEMD
#include <systemd/sd-daemon.h>
#endif
@@ -56,6 +57,10 @@
#include "iscsid_req.h"
#include "iscsi_err.h"
+#ifndef PR_SET_IO_FLUSHER
+#define PR_SET_IO_FLUSHER 57
+#endif
+
/* global config info */
struct iscsi_daemon_config daemon_config;
struct iscsi_daemon_config *dconfig = &daemon_config;
@@ -616,6 +621,15 @@ int main(int argc, char *argv[])
exit(ISCSI_ERR);
}
+ if (prctl(PR_SET_IO_FLUSHER, 1, 0, 0, 0) == -1) {
+ if (errno == EINVAL) {
+ log_info("prctl could not mark iscsid with the PR_SET_IO_FLUSHER flag, because the feature is not supported in this kernel. Will proceed, but iscsid may hang during session level recovery if memory is low.\n");
+ } else {
+ log_error("prctl could not mark iscsid with the PR_SET_IO_FLUSHER flag due to error %s\n",
+ strerror(errno));
+ }
+ }
+
set_state_to_ready();
event_loop(ipc, control_fd, mgmt_ipc_fd);