block.c (418661e0324c1c419552cf24bd4447292e884bdd) block.c (16e977d506bcc2d9f7daa4a9f7cc2b48536d9da6)
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 3234 unchanged lines hidden (view full) ---

3243
3244 if (!bs->drv) {
3245 return;
3246 }
3247
3248 if (!(bs->open_flags & BDRV_O_INACTIVE)) {
3249 return;
3250 }
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 3234 unchanged lines hidden (view full) ---

3243
3244 if (!bs->drv) {
3245 return;
3246 }
3247
3248 if (!(bs->open_flags & BDRV_O_INACTIVE)) {
3249 return;
3250 }
3251 bs->open_flags &= ~BDRV_O_INACTIVE;
3252
3251
3253 if (bs->drv->bdrv_invalidate_cache) {
3254 bs->drv->bdrv_invalidate_cache(bs, &local_err);
3252 QLIST_FOREACH(child, &bs->children, next) {
3253 bdrv_invalidate_cache(child->bs, &local_err);
3255 if (local_err) {
3254 if (local_err) {
3256 bs->open_flags |= BDRV_O_INACTIVE;
3257 error_propagate(errp, local_err);
3258 return;
3259 }
3260 }
3261
3255 error_propagate(errp, local_err);
3256 return;
3257 }
3258 }
3259
3262 QLIST_FOREACH(child, &bs->children, next) {
3263 bdrv_invalidate_cache(child->bs, &local_err);
3260 bs->open_flags &= ~BDRV_O_INACTIVE;
3261 if (bs->drv->bdrv_invalidate_cache) {
3262 bs->drv->bdrv_invalidate_cache(bs, &local_err);
3264 if (local_err) {
3265 bs->open_flags |= BDRV_O_INACTIVE;
3266 error_propagate(errp, local_err);
3267 return;
3268 }
3269 }
3270
3271 ret = refresh_total_sectors(bs, bs->total_sectors);

--- 837 unchanged lines hidden ---
3263 if (local_err) {
3264 bs->open_flags |= BDRV_O_INACTIVE;
3265 error_propagate(errp, local_err);
3266 return;
3267 }
3268 }
3269
3270 ret = refresh_total_sectors(bs, bs->total_sectors);

--- 837 unchanged lines hidden ---