summaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-09-25 14:22:56 -0600
committerJens Axboe <axboe@fb.com>2016-09-25 14:22:56 -0600
commit81b3c86f086cb2340d1c5596202a307487216b21 (patch)
tree1da4f3704da2fdd57fb6255365ae629606ef23e3 /server.c
parent0e4a9bc81d0af7358f14a1c2a9bc3351f1b6a0b1 (diff)
smalloc: OOM fixups
Warn directly in smalloc() instead of having the callers do it. Add a hint on how to solve a situation where we run out of shared memory. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'server.c')
-rw-r--r--server.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/server.c b/server.c
index 3862699..091c161 100644
--- a/server.c
+++ b/server.c
@@ -578,8 +578,12 @@ static int fio_net_queue_cmd(uint16_t opcode, void *buf, off_t size,
struct sk_entry *entry;
entry = fio_net_prep_cmd(opcode, buf, size, tagptr, flags);
- fio_net_queue_entry(entry);
- return 0;
+ if (entry) {
+ fio_net_queue_entry(entry);
+ return 0;
+ }
+
+ return 1;
}
static int fio_net_send_simple_stack_cmd(int sk, uint16_t opcode, uint64_t tag)
@@ -1999,10 +2003,8 @@ int fio_server_get_verify_state(const char *name, int threadnumber,
dprint(FD_NET, "server: request verify state\n");
rep = smalloc(sizeof(*rep));
- if (!rep) {
- log_err("fio: smalloc pool too small\n");
+ if (!rep)
return ENOMEM;
- }
__fio_mutex_init(&rep->lock, FIO_MUTEX_LOCKED);
rep->data = NULL;