[master] b27fc03d5 mark where we might want to handle ENOSPC
    Nils Goroll 
    nils.goroll at uplex.de
       
    Thu Apr 18 08:23:06 UTC 2019
    
    
  
commit b27fc03d5b8f9e2f2fffb19904d39821d622e7de
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Apr 18 10:15:26 2019 +0200
    mark where we might want to handle ENOSPC
    
    ... which would require error handling on all of the call stack upwards,
    which is not that trivial an endavour. Also, for the calls via
    VSMW_DestroyCluster(), we are actually about to free space, but
    temporarily need more.
    
    Other ideas:
    
    - panic, but leave a better error message
    - monitor free space and refuse loading vcls if insufficient
    - maybe as part of some more general vcl management (e.g.
      "maintain max xx vcls loaded - aka auto-discard)
    
    Ref #2764
diff --git a/bin/varnishd/common/common_vsmw.c b/bin/varnishd/common/common_vsmw.c
index ba83b862b..7a2d9c040 100644
--- a/bin/varnishd/common/common_vsmw.c
+++ b/bin/varnishd/common/common_vsmw.c
@@ -122,6 +122,7 @@ vsmw_idx_head(const struct vsmw *vsmw, int fd)
 	char buf[64];
 
 	bprintf(buf, "# %jd %jd\n", (intmax_t)vsmw->pid, (intmax_t)vsmw->birth);
+	// XXX handle ENOSPC? #2764
 	assert(write(fd, buf, strlen(buf)) == strlen(buf));
 }
 
@@ -177,6 +178,7 @@ vsmw_addseg(struct vsmw *vsmw, struct vsmwseg *seg)
 	vsmw_fmt_index(vsmw, seg);
 	AZ(VSB_finish(vsmw->vsb));
 	s = write(fd, VSB_data(vsmw->vsb), VSB_len(vsmw->vsb));
+	// XXX handle ENOSPC? #2764
 	assert(s == VSB_len(vsmw->vsb));
 	closefd(&fd);
 }
@@ -211,6 +213,7 @@ vsmw_delseg(struct vsmw *vsmw, struct vsmwseg *seg, int fixidx)
 			vsmw_fmt_index(vsmw, seg);
 		AZ(VSB_finish(vsmw->vsb));
 		s = write(fd, VSB_data(vsmw->vsb), VSB_len(vsmw->vsb));
+		// XXX handle ENOSPC? #2764
 		assert(s == VSB_len(vsmw->vsb));
 		closefd(&fd);
 		AZ(renameat(vsmw->vdirfd, t, vsmw->vdirfd, vsmw->idx));
    
    
More information about the varnish-commit
mailing list