diff options
author | Ilya Dryomov | 2019-05-03 17:27:03 +0200 |
---|---|---|
committer | Ilya Dryomov | 2019-05-07 19:43:04 +0200 |
commit | b91a7bdca4439e286f26cdd6c15ed338e6a9fda2 (patch) | |
tree | 42d2f711a43e483b30a68dac8e23bac1af3a94a9 | |
parent | rbd: client_mutex is never nested (diff) | |
download | kernel-qcow2-linux-b91a7bdca4439e286f26cdd6c15ed338e6a9fda2.tar.gz kernel-qcow2-linux-b91a7bdca4439e286f26cdd6c15ed338e6a9fda2.tar.xz kernel-qcow2-linux-b91a7bdca4439e286f26cdd6c15ed338e6a9fda2.zip |
rbd: don't assert on writes to snapshots
The check added in commit 721c7fc701c7 ("block: fail op_is_write()
requests to read-only partitions") was lifted in commit a32e236eb93e
("Partially revert "block: fail op_is_write() requests to read-only
partitions""). Basic things like user triggered writes and discards
are still caught, but internal kernel users can submit anything. In
particular, ext4 will attempt to write to the superblock if it detects
errors in the filesystem, even if the filesystem is mounted read-only
on a read-only partition.
The assert is overkill regardless.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r-- | drivers/block/rbd.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 99de7166bf89..e5009a34f9c2 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3842,8 +3842,12 @@ static void rbd_queue_workfn(struct work_struct *work) goto err_rq; } - rbd_assert(op_type == OBJ_OP_READ || - rbd_dev->spec->snap_id == CEPH_NOSNAP); + if (op_type != OBJ_OP_READ && rbd_dev->spec->snap_id != CEPH_NOSNAP) { + rbd_warn(rbd_dev, "%s on read-only snapshot", + obj_op_name(op_type)); + result = -EIO; + goto err; + } /* * Quit early if the mapped snapshot no longer exists. It's |