From d7b74f9a683797f75cc51355a790ee49fa05fe4a Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 12 Feb 2004 20:47:21 +0000
Subject: [PATCH] Always run chmod 700 on SlurmdSpoolDir. Previously slurmd
 would create the directory with access rights based upon its umask. A umask
 value of 007 when creating the directory results in batch jobs always
 failing.

---
 NEWS                |  2 ++
 src/slurmd/slurmd.c | 14 +++++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/NEWS b/NEWS
index af6ab801b61..574f002354d 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ documents those changes that are of interest to users and admins.
     fails)
  -- Node does not transition from COMPLETING to DOWN state due to 
     not responding. Wait for tasks to complete or admin to set DOWN
+ -- Always chmod SlurmdSpoolDir to 755 (a umask of 007 was resulting 
+    in batch jobs failing)
 
 * Changes in SLURM 0.3.0.0-pre6
 ===============================
diff --git a/src/slurmd/slurmd.c b/src/slurmd/slurmd.c
index c39ed90e45f..246bd7206d2 100644
--- a/src/slurmd/slurmd.c
+++ b/src/slurmd/slurmd.c
@@ -832,14 +832,14 @@ _set_slurmd_spooldir(void)
 			fatal("mkdir(%s): %m", conf->spooldir);
 			return SLURM_ERROR;
 		}
+	}
 
-		/* 
-		 * Ensure spool directory permissions are correct.
-		 */
-		if (chmod(conf->spooldir, 0755) < 0) {
-			error("chmod(%s, 0755): %m", conf->spooldir);
-			return SLURM_ERROR;
-		}
+	/* 
+	 * Ensure spool directory permissions are correct.
+	 */
+	if (chmod(conf->spooldir, 0755) < 0) {
+		error("chmod(%s, 0755): %m", conf->spooldir);
+		return SLURM_ERROR;
 	}
 
 	return SLURM_SUCCESS;
-- 
GitLab