From e6b7acc169f877fc3b12d0691ed20dc618fe4498 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Thu, 9 Oct 2008 12:57:51 +0000 Subject: [PATCH] get rid of semaphore locks -- they are not used anymore --- org.glite.lb.common/interface/context-int.h | 2 -- org.glite.lb.server/Makefile | 6 ++-- org.glite.lb.server/src/bkserverd.c | 33 ++--------------- org.glite.lb.server/src/jobstat.c | 1 - org.glite.lb.server/src/lock.c | 56 ----------------------------- org.glite.lb.server/src/lock.h | 14 -------- org.glite.lb.server/src/seqcode.c | 1 - org.glite.lb.server/src/srv_purge.c | 1 - org.glite.lb.server/src/store.c.T | 1 - org.glite.lb.server/src/write2rgma.c | 1 - 10 files changed, 5 insertions(+), 111 deletions(-) delete mode 100644 org.glite.lb.server/src/lock.c delete mode 100644 org.glite.lb.server/src/lock.h diff --git a/org.glite.lb.common/interface/context-int.h b/org.glite.lb.common/interface/context-int.h index e5f5aba..b717155 100644 --- a/org.glite.lb.common/interface/context-int.h +++ b/org.glite.lb.common/interface/context-int.h @@ -68,8 +68,6 @@ glite_lb_padded_struct(_edg_wll_Context,150, edg_wll_ConnPool *connPoolNotif; /* hold _one_ connection from notif-interlogger */ edg_wll_ConnProxy *connProxy; /* holds one plain connection */ - int semaphores; - int semset; edg_wll_QueryRec **job_index; void *job_index_cols; diff --git a/org.glite.lb.server/Makefile b/org.glite.lb.server/Makefile index 15976af..9eb2de5 100644 --- a/org.glite.lb.server/Makefile +++ b/org.glite.lb.server/Makefile @@ -161,7 +161,7 @@ BKSERVER_BASE_OBJS:= \ bkserverd.o il_lbproxy.o get_events.o index.o jobstat.o jobstat_supp.o \ seqcode.o write2rgma.o lb_html.o lb_http.o lb_proto.o lb_xml_parse.o \ lb_xml_parse_V21.o lb_text.o \ - lock.o openserver.o query.o userjobs.o db_store.o request.o store.o \ + openserver.o query.o userjobs.o db_store.o request.o store.o \ stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \ notification.o il_notification.o notif_match.o stats.o db_calls.o db_supp.o @@ -201,7 +201,7 @@ else endif INDEX_OBJS:= index.o index_parse.o jobstat_supp.o openserver.o \ - jobstat.o query.o lock.o get_events.o write2rgma.o index_lex.o \ + jobstat.o query.o get_events.o write2rgma.o index_lex.o \ lb_authz.o store.o bkindex.o stats.o\ request.o db_store.o srv_purge.o notif_match.o il_lbproxy.o dump.o lb_xml_parse.o il_notification.o lb_proto.o lb_text.o server_state.o lb_xml_parse_V21.o lb_html.o notification.o seqcode.o userjobs.o load.o db_calls.o db_supp.lo @@ -228,7 +228,7 @@ LIB_OBJS_BK:= \ il_lbproxy.o get_events.o index.o jobstat.o jobstat_supp.o \ seqcode.o lb_html.o lb_http.o lb_proto.o lb_xml_parse.o \ lb_xml_parse_V21.o lb_text.o \ - lock.o openserver.o query.o userjobs.o db_store.o request.o store.o \ + openserver.o query.o userjobs.o db_store.o request.o store.o \ stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \ notification.o il_notification.o notif_match.o stats.o write2rgma.o \ db_calls.o db_supp.o diff --git a/org.glite.lb.server/src/bkserverd.c b/org.glite.lb.server/src/bkserverd.c index fd8c46e..2635788 100644 --- a/org.glite.lb.server/src/bkserverd.c +++ b/org.glite.lb.server/src/bkserverd.c @@ -25,8 +25,6 @@ #include #include #include -#include -#include #include #ifdef GLITE_LB_SERVER_WITH_WS @@ -141,9 +139,7 @@ int transactions = -1; int use_dbcaps = 0; static int fake_port = 0; static char **super_users = NULL; -static int slaves = 10, - semaphores = -1, - semset; +static int slaves = 10; static char *purgeStorage = EDG_PURGE_STORAGE; static char *dumpStorage = EDG_DUMP_STORAGE; static char *jpregDir = JPREG_DEF_DIR; @@ -187,7 +183,6 @@ static struct option opts[] = { {"mysql", 1, NULL, 'm'}, {"noauth", 0, NULL, 'n'}, {"slaves", 1, NULL, 's'}, - {"semaphores", 1, NULL, 'l'}, {"pidfile", 1, NULL, 'i'}, {"purge-prefix", 1, NULL, 'S'}, {"dump-prefix", 1, NULL, 'D'}, @@ -218,7 +213,7 @@ static struct option opts[] = { {NULL,0,NULL,0} }; -static const char *get_opt_string = "Ac:k:C:V:p:a:drm:ns:l:i:S:D:J:jR:F:xOL:N:X:Y:T:t:zb:gPBo:q:W:Z:" +static const char *get_opt_string = "Ac:k:C:V:p:a:drm:ns:i:S:D:J:jR:F:xOL:N:X:Y:T:t:zb:gPBo:q:W:Z:" #ifdef GLITE_LB_SERVER_WITH_WS "w:" #endif @@ -246,7 +241,6 @@ static void usage(char *me) "\t-r, --rgmaexport write state info to RGMA interface\n" "\t-n, --noauth\t don't check user identity with result owner\n" "\t-s, --slaves\t number of slave servers to fork\n" - "\t-l, --semaphores number of semaphores (job locks) to use\n" "\t-i, --pidfile\t file to store master pid\n" "\t-L, --limits\t query limits numbers in format \"events_limit:jobs_limit:size_limit\"\n" "\t-N, --notif-dur default[:max]\t Duration of notification registrations in seconds (default and maximal)\n" @@ -377,7 +371,6 @@ int main(int argc, char *argv[]) char *ws_port; #endif /* GLITE_LB_SERVER_WITH_WS */ FILE *fpid; - key_t semkey; edg_wll_Context ctx; edg_wll_GssStatus gss_code; struct timeval to; @@ -423,7 +416,6 @@ int main(int argc, char *argv[]) case 'm': dbstring = optarg; break; case 'n': noAuth = 1; break; case 's': slaves = atoi(optarg); break; - case 'l': semaphores = atoi(optarg); break; case 'S': purgeStorage = optarg; break; case 'D': dumpStorage = optarg; break; case 'J': jpregDir = optarg; jpreg = 1; break; @@ -526,8 +518,6 @@ int main(int argc, char *argv[]) if (fprintf(fpid, "%d", getpid()) <= 0) { perror(pidfile); return 1; } if (fclose(fpid) != 0) { perror(pidfile); return 1; } - semkey = ftok(pidfile,0); - if (mode & SERVICE_SERVER) { if (check_mkdir(dumpStorage)) exit(1); if (check_mkdir(purgeStorage)) exit(1); @@ -540,20 +530,6 @@ int main(int argc, char *argv[]) } } - if (semaphores == -1) semaphores = slaves; - semset = semget(semkey, 0, 0); - if (semset >= 0) semctl(semset, 0, IPC_RMID); - semset = semget(semkey, semaphores, IPC_CREAT | 0600); - if (semset < 0) { perror("semget()"); return 1; } - dprintf(("Using %d semaphores, set id %d\n",semaphores,semset)); - for (i=0; ijpreg_dir = strdup(jpregDir); else ctx->jpreg_dir = NULL; ctx->hardJobsLimit = hardJobsLimit; ctx->hardEventsLimit = hardEventsLimit; - ctx->semset = semset; - ctx->semaphores = semaphores; if ( noAuth ) ctx->noAuth = 1; ctx->rgma_export = rgma_export; memcpy(ctx->purge_timeout, purge_timeout, sizeof(ctx->purge_timeout)); @@ -1240,8 +1213,6 @@ int bk_handle_connection_proxy(int conn, struct timeval *timeout, void *data) ctx->isProxy = 1; ctx->noAuth = 1; ctx->noIndex = 1; - ctx->semset = semset; - ctx->semaphores = semaphores; if (fake_host) diff --git a/org.glite.lb.server/src/jobstat.c b/org.glite.lb.server/src/jobstat.c index bfc9796..0af26a2 100644 --- a/org.glite.lb.server/src/jobstat.c +++ b/org.glite.lb.server/src/jobstat.c @@ -18,7 +18,6 @@ #include "get_events.h" #include "store.h" -#include "lock.h" #include "index.h" #include "jobstat.h" #include "lb_authz.h" diff --git a/org.glite.lb.server/src/lock.c b/org.glite.lb.server/src/lock.c deleted file mode 100644 index 8765f3e..0000000 --- a/org.glite.lb.server/src/lock.c +++ /dev/null @@ -1,56 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include -#include - -#include "glite/jobid/cjobid.h" -#include "glite/lb/context-int.h" -#include "lock.h" - -extern int debug; - -int edg_wll_JobSemaphore(const edg_wll_Context ctx, glite_jobid_const_t job) -{ - char *un = edg_wlc_JobIdGetUnique(job); - int n,i; - static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; - - - if (!un) { - edg_wll_SetError(ctx,EINVAL,"jobid"); - return -1; - } - - for (n=0; nsemaphores); -} - -int edg_wll_LockUnlockJob(const edg_wll_Context ctx,glite_jobid_const_t job,int lock) -{ - struct sembuf s; - int n; - - - if ((n=edg_wll_JobSemaphore(ctx, job)) == -1) return edg_wll_Error(ctx,NULL,NULL); - - if (debug) fprintf(stderr,"[%d] try semop(%d,%d) \n",getpid(),n,lock); - - s.sem_num = n; - s.sem_op = lock; - s.sem_flg = SEM_UNDO; - - if (semop(ctx->semset,&s,1)) { - if (debug) fprintf(stderr,"[%d] failed semop(%d,%d) \n",getpid(),n,lock); - return edg_wll_SetError(ctx,errno,"edg_wll_LockUnlockJob()"); - } - - if (debug) fprintf(stderr,"[%d] got semop(%d,%d) \n",getpid(),n,lock); - return edg_wll_ResetError(ctx); -} diff --git a/org.glite.lb.server/src/lock.h b/org.glite.lb.server/src/lock.h deleted file mode 100644 index 2649d9a..0000000 --- a/org.glite.lb.server/src/lock.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef GLITE_LB_LOCK_H -#define GLITE_LB_LOCK_H - -#ident "$Header$" - -#include "glite/lb/context.h" - -#define edg_wll_LockJob(ctx,job) edg_wll_LockUnlockJob((ctx),(job),-1) -#define edg_wll_UnlockJob(ctx,job) edg_wll_LockUnlockJob((ctx),(job),1) - -int edg_wll_LockUnlockJob(const edg_wll_Context,glite_jobid_const_t,int); -int edg_wll_JobSemaphore(const edg_wll_Context ctx, glite_jobid_const_t job); - -#endif /* GLITE_LB_LOCK_H */ diff --git a/org.glite.lb.server/src/seqcode.c b/org.glite.lb.server/src/seqcode.c index cc46616..a9f18f3 100644 --- a/org.glite.lb.server/src/seqcode.c +++ b/org.glite.lb.server/src/seqcode.c @@ -7,7 +7,6 @@ #include "get_events.h" #include "store.h" -#include "lock.h" #include "jobstat.h" /* #include "lb_authz.h" diff --git a/org.glite.lb.server/src/srv_purge.c b/org.glite.lb.server/src/srv_purge.c index fae2d96..9d10138 100644 --- a/org.glite.lb.server/src/srv_purge.c +++ b/org.glite.lb.server/src/srv_purge.c @@ -21,7 +21,6 @@ #include "lb_html.h" #include "lb_proto.h" #include "store.h" -#include "lock.h" #include "query.h" #include "get_events.h" #include "purge.h" diff --git a/org.glite.lb.server/src/store.c.T b/org.glite.lb.server/src/store.c.T index 37a2b92..365268f 100644 --- a/org.glite.lb.server/src/store.c.T +++ b/org.glite.lb.server/src/store.c.T @@ -27,7 +27,6 @@ #include "store.h" #include "get_events.h" -#include "lock.h" #include "lb_authz.h" #include "jobstat.h" #include "db_calls.h" diff --git a/org.glite.lb.server/src/write2rgma.c b/org.glite.lb.server/src/write2rgma.c index c6b4e4a..fe9075a 100755 --- a/org.glite.lb.server/src/write2rgma.c +++ b/org.glite.lb.server/src/write2rgma.c @@ -20,7 +20,6 @@ #include "get_events.h" #include "store.h" -#include "lock.h" #include "index.h" #include "jobstat.h" -- 1.8.2.3