rbd: treat images mapped read-only seriously
authorIlya Dryomov <idryomov@gmail.com>
Fri, 8 Nov 2019 14:26:51 +0000 (15:26 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 25 Nov 2019 10:44:02 +0000 (11:44 +0100)
commitb948ad78971fb2c6ed6b53b0edbdd720cfe08d9f
tree156192d5d3ce5a560a8c29af39af4e4dd4fe96fd
parent39258aa2db8175271d8079b7685a6e328a8c1a63
rbd: treat images mapped read-only seriously

Even though -o ro/-o read_only/--read-only options are very old, we
have never really treated them seriously (on par with snapshots).  As
a first step, fail writes to images mapped read-only just like we do
for snapshots.

We need this check in rbd because the block layer basically ignores
read-only setting, see commit a32e236eb93e ("Partially revert "block:
fail op_is_write() requests to read-only partitions"").

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Reviewed-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
drivers/block/rbd.c