check that the umount actually worked and keep running if fusermount returned error...
authorroot <root@rcn1.VSOFS1.COM>
Mon, 6 Apr 2009 23:41:41 +0000 (09:41 +1000)
committerroot <root@rcn1.VSOFS1.COM>
Mon, 6 Apr 2009 23:41:41 +0000 (09:41 +1000)
migrate/remote-cached.c

index df2538e5449ac085b6fde5774044a36c54c90ad7..cf9cd7a7d5eb64d69771005b269916b5ca9d392b 100644 (file)
@@ -216,9 +216,18 @@ static void migd_sigusr2_handler(struct event_context *ev, struct signal_event *
        char *cmd;
        int ret;
 
-       cmd = talloc_asprintf(mem_ctx, "fusermount -u %s\n", export);
+       cmd = talloc_asprintf(mem_ctx, "fusermount -u %s", export);
        DEBUG(DEBUG_ERR,("Got SIGUSR2, unmounting fuse filesystem %s\n", export));
        ret = system(cmd);
+       if (ret == -1) {
+               DEBUG(DEBUG_ERR,("system(%s) call failed : %s\n", cmd, strerror(errno)));
+               return;
+       }
+       ret = WEXITSTATUS(ret);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR,("%s failed with return code %d. Umount failed.\n", cmd, ret));
+               return;
+       }
 
        talloc_free(mem_ctx);
        _exit(10);