Skip to content

Commit 93da6b8

Browse files
committed
rublk: compress: don't call db.flush() in case of readonly when exiting
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
1 parent d8e7bca commit 93da6b8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/compress.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,13 @@ pub(crate) fn ublk_add_compress(
491491
comm.send_dev_id(dev.dev_info().dev_id).unwrap();
492492
});
493493

494-
log::info!("ublk device stopped, flushing RocksDB before exit...");
495-
db_arc.flush()?;
496-
log::info!("Final RocksDB flush successful.");
494+
if !read_only {
495+
log::info!("ublk device stopped, flushing RocksDB before exit...");
496+
db_arc.flush()?;
497+
log::info!("Final RocksDB flush successful.");
498+
}
497499

498500
run_result.unwrap();
499501

500502
Ok(0)
501-
}
503+
}

0 commit comments

Comments
 (0)