Reply with -EROFS to write commands in readonly mode

trace-sqes
Vitaliy Filippov 2020-05-01 00:54:34 +03:00
parent 762bd42096
commit ce78454215
1 changed files with 10 additions and 0 deletions

10
osd.cpp
View File

@ -453,6 +453,16 @@ void osd_t::exec_op(osd_op_t *cur_op)
finish_op(cur_op, -EINVAL);
return;
}
if (readonly &&
cur_op->req.hdr.opcode != OSD_OP_SECONDARY_READ &&
cur_op->req.hdr.opcode != OSD_OP_SECONDARY_LIST &&
cur_op->req.hdr.opcode != OSD_OP_READ &&
cur_op->req.hdr.opcode != OSD_OP_SHOW_CONFIG)
{
// Readonly mode
finish_op(cur_op, -EROFS);
return;
}
if (cur_op->req.hdr.opcode == OSD_OP_TEST_SYNC_STAB_ALL)
{
exec_sync_stab_all(cur_op);