File nfs-utils-1.1.3-sm-notify.patch of Package nfs-utils

diff -ur nfs-utils-1.1.3/utils/statd/sm-notify.c nfs-utils-1.1.3/utils/statd/sm-notify.c
--- nfs-utils-1.1.3/utils/statd/sm-notify.c
+++ nfs-utils-1.1.3/utils/statd/sm-notify.c
@@ -76,7 +76,7 @@
 static uint16_t		opt_srcport = 0;
 static int		log_syslog = 0;
 
-static unsigned int	nsm_get_state(int);
+static unsigned int	nsm_get_state(int, int);
 static void		notify(void);
 static int		notify_host(int, struct nsm_host *);
 static void		recv_reply(int);
@@ -169,8 +169,8 @@
 	backup_hosts(_SM_DIR_PATH, _SM_BAK_PATH);
 	get_hosts(_SM_BAK_PATH);
 
-	/* Get and update the NSM state. This will call sync() */
-	nsm_state = nsm_get_state(opt_update_state);
+	/* Get and update the NSM state. This can call sync() */
+	nsm_state = nsm_get_state(opt_update_state, hosts != NULL);
 	set_kernel_nsm_state(nsm_state);
 
 	if (!opt_debug) {
@@ -628,7 +628,7 @@
  * Retrieve the current NSM state
  */
 unsigned int
-nsm_get_state(int update)
+nsm_get_state(int update, int do_sync)
 {
 	char		newfile[PATH_MAX];
 	int		fd, state;
@@ -674,7 +674,8 @@
 				"Cannot create %s: %m", _SM_STATE_PATH);
 			exit(1);
 		}
-		sync();
+		if (do_sync)
+			sync();
 	}
 
 	return state;
openSUSE Build Service is sponsored by