Print this page
195 Need replacement for nfs/lockd+klm
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Jeremy Jones <jeremy@delphix.com>
Reviewed by: Jeff Biseda <jbiseda@delphix.com>

*** 34,44 **** * University Acknowledgment- Portions of this document are derived from * software developed by the University of California, Berkeley, and its * contributors. */ ! #pragma ident "%Z%%M% %I% %E% SMI" /* * sm_statd.c consists of routines used for the intermediate * statd implementation(3.2 rpc.statd); * it creates an entry in "current" directory for each site that it monitors; --- 34,46 ---- * University Acknowledgment- Portions of this document are derived from * software developed by the University of California, Berkeley, and its * contributors. */ ! /* ! * Copyright (c) 2012 by Delphix. All rights reserved. ! */ /* * sm_statd.c consists of routines used for the intermediate * statd implementation(3.2 rpc.statd); * it creates an entry in "current" directory for each site that it monitors;
*** 128,139 **** * Scan alternate paths for largest "state" number */ for (i = 0; i < pathix; i++) { (void) sprintf(state_file, "%s/statmon/state", path_name[i]); if ((fp_tmp = fopen(state_file, "r+")) == (FILE *)NULL) { ! if ((fp_tmp = fopen(state_file, "w+")) ! == (FILE *)NULL) { if (debug) syslog(LOG_ERR, "can't open %s: %m", state_file); continue; --- 130,141 ---- * Scan alternate paths for largest "state" number */ for (i = 0; i < pathix; i++) { (void) sprintf(state_file, "%s/statmon/state", path_name[i]); if ((fp_tmp = fopen(state_file, "r+")) == (FILE *)NULL) { ! if ((fp_tmp = fopen(state_file, "w+")) == ! (FILE *)NULL) { if (debug) syslog(LOG_ERR, "can't open %s: %m", state_file); continue;
*** 178,189 **** (void) fclose(fp); for (i = 0; i < pathix; i++) { (void) sprintf(state_file, "%s/statmon/state", path_name[i]); if ((fp_tmp = fopen(state_file, "r+")) == (FILE *)NULL) { ! if ((fp_tmp = fopen(state_file, "w+")) ! == (FILE *)NULL) { syslog(LOG_ERR, "can't open %s: %m", state_file); continue; } else (void) chmod(state_file, 0644); --- 180,191 ---- (void) fclose(fp); for (i = 0; i < pathix; i++) { (void) sprintf(state_file, "%s/statmon/state", path_name[i]); if ((fp_tmp = fopen(state_file, "r+")) == (FILE *)NULL) { ! if ((fp_tmp = fopen(state_file, "w+")) == ! (FILE *)NULL) { syslog(LOG_ERR, "can't open %s: %m", state_file); continue; } else (void) chmod(state_file, 0644);
*** 304,315 **** /* Create a thread to do a statd_call_statd for name */ if (thr_create(NULL, NULL, thr_call_statd, (void *) name, 0, 0)) { syslog(LOG_ERR, ! "statd: unable to create thr_call_statd() for name %s.\n", ! dirp->d_name); free(name); continue; } num_threads++; } --- 306,317 ---- /* Create a thread to do a statd_call_statd for name */ if (thr_create(NULL, NULL, thr_call_statd, (void *) name, 0, 0)) { syslog(LOG_ERR, ! "statd: unable to create thr_call_statd() " ! "for name %s.\n", dirp->d_name); free(name); continue; } num_threads++; }
*** 379,390 **** /* Create a thread to do a statd_call_statd for name */ if (thr_create(NULL, NULL, thr_call_statd, (void *) name, 0, 0)) { syslog(LOG_ERR, ! "statd: unable to create thr_call_statd() for name %s.\n", ! dirp->d_name); free(name); continue; } num_threads++; } --- 381,392 ---- /* Create a thread to do a statd_call_statd for name */ if (thr_create(NULL, NULL, thr_call_statd, (void *) name, 0, 0)) { syslog(LOG_ERR, ! "statd: unable to create thr_call_statd() " ! "for name %s.\n", dirp->d_name); free(name); continue; } num_threads++; }
*** 487,498 **** if (is_symlink(path)) { n = readlink(path, rname, MAXNAMELEN); if (n <= 0) { if (debug >= 2) { (void) printf( ! "thr_call_statd: can't read link %s\n", ! path); } } else { rname[n] = '\0'; tail = strrchr(path, '/') + 1; --- 489,500 ---- if (is_symlink(path)) { n = readlink(path, rname, MAXNAMELEN); if (n <= 0) { if (debug >= 2) { (void) printf( ! "thr_call_statd: can't read " ! "link %s\n", path); } } else { rname[n] = '\0'; tail = strrchr(path, '/') + 1;
*** 579,590 **** } tottimeout.tv_sec = SM_RPC_TIMEOUT; tottimeout.tv_usec = 0; ! if ((clnt = create_client(name_or_addr, SM_PROG, SM_VERS, ! &tottimeout)) == (CLIENT *) NULL) { return (-1); } /* Perform notification to client */ rc = 0; --- 581,592 ---- } tottimeout.tv_sec = SM_RPC_TIMEOUT; tottimeout.tv_usec = 0; ! if ((clnt = create_client(name_or_addr, SM_PROG, SM_VERS, NULL, ! &tottimeout)) == NULL) { return (-1); } /* Perform notification to client */ rc = 0;
*** 673,684 **** * Print message only once since unreachable * host can be contacted forever. */ if (delay == 0) syslog(LOG_WARNING, ! "statd: host %s is not responding\n", ! nl->name); } } /* * Increment the amount of delay before restarting again. * The amount of delay should not exceed the MAX_DELAYTIME. --- 675,686 ---- * Print message only once since unreachable * host can be contacted forever. */ if (delay == 0) syslog(LOG_WARNING, ! "statd: host %s is not " ! "responding\n", nl->name); } } /* * Increment the amount of delay before restarting again. * The amount of delay should not exceed the MAX_DELAYTIME.
*** 1033,1044 **** int n, error; char path[MAXPATHLEN+MAXNAMELEN+SM_MAXPATHLEN]; /* why > MAXPATHLEN? */ char dirpath[MAXPATHLEN]; char rname[MAXNAMELEN + 1]; /* +1 for NULL term */ ! if (strlen(name) + strlen(dir1) + (dir2 != NULL ? strlen(dir2) : 0) ! + 3 > MAXPATHLEN) { if (dir2 != NULL) syslog(LOG_ERR, "statd: pathname too long: %s/%s/%s\n", dir1, dir2, name); else --- 1035,1046 ---- int n, error; char path[MAXPATHLEN+MAXNAMELEN+SM_MAXPATHLEN]; /* why > MAXPATHLEN? */ char dirpath[MAXPATHLEN]; char rname[MAXNAMELEN + 1]; /* +1 for NULL term */ ! if (strlen(name) + strlen(dir1) + (dir2 != NULL ? strlen(dir2) : 0) + ! 3 > MAXPATHLEN) { if (dir2 != NULL) syslog(LOG_ERR, "statd: pathname too long: %s/%s/%s\n", dir1, dir2, name); else
*** 1076,1091 **** (void) strcat(dirpath, rname); error = unlink(dirpath); if (debug >= 2) { if (error < 0) { (void) printf( ! "remove_name: can't unlink %s\n", dirpath); } else { (void) printf( ! "remove_name: unlinked %s\n", ! dirpath); } } } } else { /* --- 1078,1094 ---- (void) strcat(dirpath, rname); error = unlink(dirpath); if (debug >= 2) { if (error < 0) { (void) printf( ! "remove_name: can't " ! "unlink %s\n", dirpath); } else { (void) printf( ! "remove_name: unlinked ", ! "%s\n", dirpath); } } } } else { /*
*** 1139,1150 **** */ n = readlink(lpath, rname, MAXNAMELEN); if (n <= 0) { if (debug >= 2) { (void) printf( ! "count_symlinks: can't read link %s\n", ! lpath); } continue; } rname[n] = '\0'; --- 1142,1153 ---- */ n = readlink(lpath, rname, MAXNAMELEN); if (n <= 0) { if (debug >= 2) { (void) printf( ! "count_symlinks: can't read link " ! "%s\n", lpath); } continue; } rname[n] = '\0';
*** 1363,1375 **** break; default: if (debug) { (void) printf( ! "record_addr: family2string supports unknown family %d (%s)\n", ! family, ! famstr); } free(famstr); return; } --- 1366,1377 ---- break; default: if (debug) { (void) printf( ! "record_addr: family2string supports unknown " ! "family %d (%s)\n", family, famstr); } free(famstr); return; }