|
|
|
|
@ -494,7 +494,7 @@ static int store_command(struct mf_storage* s, uint64_t group, uint64_t peer, co
|
|
|
|
|
if (rc) return rc; |
|
|
|
|
uint8_t version[16]; store_version(s, &info, version); |
|
|
|
|
if ((!mf_zero(q->version, 16) && memcmp(q->version, version, 16)) || |
|
|
|
|
((q->command == MF_READ || q->command == MF_RENAME || q->command == MF_REMOVE || q->cursor) && mf_zero(q->version, 16))) |
|
|
|
|
((q->command == MF_READ || q->command == MF_RENAME || q->command == MF_REMOVE_PATH || q->cursor) && mf_zero(q->version, 16))) |
|
|
|
|
return MF_STALE; |
|
|
|
|
r->size = info.size; r->mtime = info.mtime; r->type = info.type; memcpy(r->version, version, 16); |
|
|
|
|
if (q->command == MF_STAT) return MF_OK; |
|
|
|
|
@ -527,7 +527,7 @@ static int store_command(struct mf_storage* s, uint64_t group, uint64_t peer, co
|
|
|
|
|
if (u->active && !strncmp(u->path, path, n) && (!u->path[n] || u->path[n] == '/')) return MF_BUSY; |
|
|
|
|
} |
|
|
|
|
store_invalidate(s); |
|
|
|
|
if (q->command == MF_REMOVE) { |
|
|
|
|
if (q->command == MF_REMOVE_PATH) { |
|
|
|
|
struct store_user* user = store_user_get(s, q->owner, 1); |
|
|
|
|
if (!user) return MF_IO_ERROR; |
|
|
|
|
rc = mf_disk_remove(&s->root, path, info.type == MF_DIRECTORY); |
|
|
|
|
@ -580,7 +580,7 @@ void mf_storage_execute(struct mf_storage* s, uint64_t group, uint64_t peer, con
|
|
|
|
|
(unsigned long long)q->request_id, mf_command_text(q->command), q->path, (unsigned long long)q->offset, |
|
|
|
|
(unsigned long long)q->size, (unsigned long long)(user ? user->used : 0), |
|
|
|
|
(unsigned long long)(user ? user->reserved : 0), (unsigned long long)s->quota); |
|
|
|
|
int mutates = q->command == MF_COMMIT || q->command == MF_MKDIR || q->command == MF_RENAME || q->command == MF_REMOVE; |
|
|
|
|
int mutates = q->command == MF_COMMIT || q->command == MF_MKDIR || q->command == MF_RENAME || q->command == MF_REMOVE_PATH; |
|
|
|
|
struct store_receipt* slot = NULL; |
|
|
|
|
uint8_t wire[MF_WIRE_MAX], fingerprint[32]; |
|
|
|
|
int n = mf_encode(q, wire, sizeof(wire)); |
|
|
|
|
|