Skip to contentSkip to conversation

Fix COR by disabling BDRV_O_COPY_ON_READ before opening the backing_file.

PATCH Applied Thibaut LAURENT 4 participants 4 messages Oct 25, 2013 – Oct 29, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix COR by disabling BDRV_O_COPY_ON_READ before opening the backing_file.

Since commit 0ebd24e0a203cf2852c310b59fbe050190dc6c8c, bdrv_open_common will throw an error when trying to open a file read-only with the BDRV_O_COPY_ON_READ flag set.
Although BDRV_O_RDWR is unset for the backing files, BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested for the drive. Let's unset this flag too before opening the backing file, or bdrv_open_common will fail.

---
 block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block.c +2 -1
index fd05a80..4474012 100644
@@ -999,7 +999,8 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
     }
 
     /* backing files always opened read-only */
-    back_flags = bs->open_flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT);
+    back_flags = bs->open_flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT |
+                                    BDRV_O_COPY_ON_READ);
 
     ret = bdrv_open(bs->backing_hd,
                     *backing_filename ? backing_filename : NULL, options,
Signature · 1 line
1.8.4.1
Reviewed-by on v1 1/1
#1 lore raw

Am 25.10.2013 02:15, schrieb Thibaut LAURENT:

Quoted 8 lines

Since commit 0ebd24e0a203cf2852c310b59fbe050190dc6c8c, bdrv_open_common will throw an error when trying to open a file read-only with the BDRV_O_COPY_ON_READ flag set.
Although BDRV_O_RDWR is unset for the backing files, BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested for the drive. Let's unset this flag too before opening the backing file, or bdrv_open_common will fail.

Quoted 4 lines
---
 block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by Benoit Canet on v1 1/1
#3 lore raw
In reply to Thibaut LAURENT
Quoted 31 lines · Thibaut LAURENT

Since commit 0ebd24e0a203cf2852c310b59fbe050190dc6c8c, bdrv_open_common will throw an error when trying to open a file read-only with the BDRV_O_COPY_ON_READ flag set.
Although BDRV_O_RDWR is unset for the backing files, BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested for the drive. Let's unset this flag too before opening the backing file, or bdrv_open_common will fail.

---
 block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block.c +2 -1
index fd05a80..4474012 100644
@@ -999,7 +999,8 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
     }
 
     /* backing files always opened read-only */
-    back_flags = bs->open_flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT);
+    back_flags = bs->open_flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT |
+                                    BDRV_O_COPY_ON_READ);
 
     ret = bdrv_open(bs->backing_hd,
                     *backing_filename ? backing_filename : NULL, options,
Signature · 1 line
1.8.4.1
Applied
#2 lore raw
In reply to Max Reitz

Am 26.10.2013 um 15:31 hat Max Reitz geschrieben:

Quoted 9 lines

Am 25.10.2013 02:15, schrieb Thibaut LAURENT:

Quoted 8 lines

Since commit 0ebd24e0a203cf2852c310b59fbe050190dc6c8c, bdrv_open_common will throw an error when trying to open a file read-only with the BDRV_O_COPY_ON_READ flag set.
Although BDRV_O_RDWR is unset for the backing files, BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested for the drive. Let's unset this flag too before opening the backing file, or bdrv_open_common will fail.

Quoted 6 lines
Quoted 4 lines
---
 block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks, applied to the block branch. (And thanks for CCing me, Max, I would have missed the patch otherwise.)

Kevin