]> git.proxmox.com Git - pve-kernel.git/commitdiff
backport: rbd: don't assert on writes to snapshots
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 Jul 2019 05:30:36 +0000 (07:30 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 24 Jul 2019 06:11:49 +0000 (08:11 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
patches/kernel/0007-rbd-don-t-assert-on-writes-to-snapshots.patch [new file with mode: 0644]

diff --git a/patches/kernel/0007-rbd-don-t-assert-on-writes-to-snapshots.patch b/patches/kernel/0007-rbd-don-t-assert-on-writes-to-snapshots.patch
new file mode 100644 (file)
index 0000000..0a69d63
--- /dev/null
@@ -0,0 +1,41 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Ilya Dryomov <idryomov@gmail.com>
+Date: Fri, 3 May 2019 17:27:03 +0200
+Subject: [PATCH] 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>
+Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
+---
+ drivers/block/rbd.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
+index 1e92b61d0bd5..339cdd4062bb 100644
+--- a/drivers/block/rbd.c
++++ b/drivers/block/rbd.c
+@@ -3664,8 +3664,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