DLM patches from PLD Linux
Hello,
These are three of the patches I have applied to dlm when packaging it for PLD Linux. I think they could be applied upstream.
Greets,
Jacek
PATCH 1/3 Fix linking order
Objects should generally be listed before the libraries they require. DLM building fails for me without these changes.
--- dlm_controld/Makefile | 4 ++-- dlm_tool/Makefile | 2 +- fence/Makefile | 2 +- libdlm/Makefile | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-)
dlm_controld/Makefile +2 -2
@@ -62,10 +62,10 @@ LIB_LDFLAGS += -Wl,-z,relro -pie all: $(LIB_TARGET) $(BIN_TARGET) $(BIN_TARGET): $(BIN_SOURCE) - $(CC) $(BIN_CFLAGS) $(BIN_LDFLAGS) $(BIN_SOURCE) -o $@ -L. + $(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L. $(LIB_TARGET): $(LIB_SOURCE) - $(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_SMAJOR) $^ + $(CC) $^ $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_SMAJOR) ln -sf $(LIB_TARGET) $(LIB_SO) ln -sf $(LIB_TARGET) $(LIB_SMAJOR)
dlm_tool/Makefile +1 -1
@@ -39,7 +39,7 @@ BIN_LDFLAGS += -lpthread -ldlm -ldlmcontrol all: $(BIN_TARGET) $(BIN_TARGET): $(BIN_SOURCE) - $(CC) $(BIN_CFLAGS) $(BIN_LDFLAGS) $(BIN_SOURCE) -o $@ + $(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ clean: rm -f *.o *.so *.so.* $(BIN_TARGET)
fence/Makefile +1 -1
@@ -40,7 +40,7 @@ BIN_LDFLAGS += -ldl all: $(BIN_TARGET) $(BIN_TARGET): $(BIN_SOURCE) - $(CC) $(BIN_CFLAGS) $(BIN_LDFLAGS) $(BIN_SOURCE) -o $@ -L. + $(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L. clean: rm -f *.o *.so *.so.* $(BIN_TARGET)
libdlm/Makefile +4 -4
@@ -86,18 +86,18 @@ LLT_LDFLAGS += $(LDFLAGS) all: $(LIB_TARGET) $(LLT_TARGET) $(LIB_PC) $(LLT_PC) $(LIB_O): $(SOURCE) - $(CC) $(LIB_CFLAGS) -c -o $@ $< + $(CC) $< $(LIB_CFLAGS) -c -o $@ $(LLT_O): $(SOURCE) - $(CC) $(LLT_CFLAGS) -c -o $@ $< + $(CC) $< $(LLT_CFLAGS) -c -o $@ $(LIB_TARGET): $(LIB_O) - $(CC) $(LIB_LDFLAGS) -shared -o $@ -Wl,-soname=$(LIB_SMAJOR) $^ + $(CC) $^ $(LIB_LDFLAGS) -shared -o $@ -Wl,-soname=$(LIB_SMAJOR) ln -sf $(LIB_TARGET) $(LIB_SO) ln -sf $(LIB_TARGET) $(LIB_SMAJOR) $(LLT_TARGET): $(LLT_O) - $(CC) $(LLT_LDFLAGS) -shared -o $@ -Wl,-soname=$(LLT_SMAJOR) $^ + $(CC) $^ $(LLT_LDFLAGS) -shared -o $@ -Wl,-soname=$(LLT_SMAJOR) ln -sf $(LLT_TARGET) $(LLT_SO) ln -sf $(LLT_TARGET) $(LLT_SMAJOR)
Signature · 1 line
1.7.12.4
PATCH 2/3 Run dlm.service after sys-kernel-config.mount
In reply to Jacek Koniecznydlm_controld requires configfs mounted. systemd can take care for that, but it does it better if the order is set in the unit file.
--- init/dlm.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
init/dlm.service +1 -1
@@ -1,6 +1,6 @@ [Unit] Description=dlm control daemon -After=syslog.target network.target corosync.service +After=syslog.target network.target corosync.service sys-kernel-config.mount [Service] Type=forking
Signature · 1 line
1.7.12.4
PATCH 3/3 Do not crash uncleanly on SIGINT and SIGHUP
In reply to Jacek KoniecznyUnclean shut-down of dlm_controld may trigger a node fencing, this should not be triggered by mistake.
SIGINT is the natural way to stop dlm_controld started on a terminal with '-D' for debugging ? let this work like SIGTERM.
SIGHUP is often used for config reload. dlm_controld doesn't support that, but when someone tries this by mistake, this is not a reason to crash.
--- dlm_controld/main.c | 9 +++++++++ 1 file changed, 9 insertions(+)
dlm_controld/main.c +9 -0
@@ -1582,6 +1582,15 @@ int main(int argc, char **argv) rv =sigaction (SIGTERM , &act,NULL );if (rv <0 )return -rv; + rv =sigaction (SIGINT , &act,NULL ); +if (rv <0 ) +return -rv; + +memset (&act,0 ,sizeof (act)); + act.sa_handler =SIG_IGN ; + rv =sigaction (SIGHUP , &act,NULL ); +if (rv <0 ) +return -rv;memset (&act,0 ,sizeof (act)); act.sa_handler = sigchld_handler;
Signature · 1 line
1.7.12.4