Beispiel #1
0
static int err_to_sderr(char *path, uint64_t oid, int err)
{
	struct stat s;
	char *dir = dirname(path);

	sd_debug("%s", dir);
	switch (err) {
	case ENOENT:
		if (stat(dir, &s) < 0) {
			sd_err("%s corrupted", dir);
			return md_handle_eio(dir);
		}
		sd_debug("object %016" PRIx64 " not found locally", oid);
		return SD_RES_NO_OBJ;
	case ENOSPC:
		/* TODO: stop automatic recovery */
		sd_err("diskfull, oid=%"PRIx64, oid);
		return SD_RES_NO_SPACE;
	case EMFILE:
	case ENFILE:
	case EINTR:
	case EAGAIN:
	case EEXIST:
		sd_err("%m, oid=%"PRIx64, oid);
		/* make gateway try again */
		return SD_RES_NETWORK_ERROR;
	default:
		sd_err("oid=%"PRIx64", %m", oid);
		return md_handle_eio(dir);
	}
}
Beispiel #2
0
static int err_to_sderr(const char *path, uint64_t oid, int err)
{
	struct stat s;
	char p[PATH_MAX], *dir;

	/* Use a temporary buffer since dirname() may modify its argument. */
	pstrcpy(p, sizeof(p), path);
	dir = dirname(p);

	sd_debug("%s", path);
	switch (err) {
	case ENOENT:
		if (stat(dir, &s) < 0) {
			sd_err("%s corrupted", dir);
			return md_handle_eio(dir);
		}
		sd_debug("object %016" PRIx64 " not found locally", oid);
		return SD_RES_NO_OBJ;
	case ENOSPC:
		/* TODO: stop automatic recovery */
		sd_err("diskfull, oid=%"PRIx64, oid);
		return SD_RES_NO_SPACE;
	case EMFILE:
	case ENFILE:
	case EINTR:
	case EAGAIN:
	case EEXIST:
		sd_err("%m, oid=%"PRIx64, oid);
		/* make gateway try again */
		return SD_RES_NETWORK_ERROR;
	default:
		sd_err("oid=%"PRIx64", %m", oid);
		return md_handle_eio(dir);
	}
}
Beispiel #3
0
static int err_to_sderr(char *path, uint64_t oid, int err)
{
    struct stat s;
    char *dir = dirname(path);

    sd_dprintf("%s", dir);
    switch (err) {
    case ENOENT:
        if (stat(dir, &s) < 0) {
            sd_eprintf("%s corrupted", dir);
            return md_handle_eio(dir);
        }
        sd_dprintf("object %016" PRIx64 " not found locally", oid);
        return SD_RES_NO_OBJ;
    case ENOSPC:
        /* TODO: stop automatic recovery */
        sd_eprintf("diskfull, oid=%"PRIx64, oid);
        return SD_RES_NO_SPACE;
    default:
        sd_eprintf("oid=%"PRIx64", %m", oid);
        return md_handle_eio(dir);
    }
}