]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0007-rbd-don-t-assert-on-writes-to-snapshots.patch
backport: rbd: don't assert on writes to snapshots
[pve-kernel.git] / patches / kernel / 0007-rbd-don-t-assert-on-writes-to-snapshots.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Ilya Dryomov <idryomov@gmail.com>
3 Date: Fri, 3 May 2019 17:27:03 +0200
4 Subject: [PATCH] rbd: don't assert on writes to snapshots
5
6 The check added in commit 721c7fc701c7 ("block: fail op_is_write()
7 requests to read-only partitions") was lifted in commit a32e236eb93e
8 ("Partially revert "block: fail op_is_write() requests to read-only
9 partitions""). Basic things like user triggered writes and discards
10 are still caught, but internal kernel users can submit anything. In
11 particular, ext4 will attempt to write to the superblock if it detects
12 errors in the filesystem, even if the filesystem is mounted read-only
13 on a read-only partition.
14
15 The assert is overkill regardless.
16
17 Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
18 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 ---
20 drivers/block/rbd.c | 8 ++++++--
21 1 file changed, 6 insertions(+), 2 deletions(-)
22
23 diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
24 index 1e92b61d0bd5..339cdd4062bb 100644
25 --- a/drivers/block/rbd.c
26 +++ b/drivers/block/rbd.c
27 @@ -3664,8 +3664,12 @@ static void rbd_queue_workfn(struct work_struct *work)
28 goto err_rq;
29 }
30
31 - rbd_assert(op_type == OBJ_OP_READ ||
32 - rbd_dev->spec->snap_id == CEPH_NOSNAP);
33 + if (op_type != OBJ_OP_READ && rbd_dev->spec->snap_id != CEPH_NOSNAP) {
34 + rbd_warn(rbd_dev, "%s on read-only snapshot",
35 + obj_op_name(op_type));
36 + result = -EIO;
37 + goto err;
38 + }
39
40 /*
41 * Quit early if the mapped snapshot no longer exists. It's