diff options
author | Xie Yongji <xieyongji@bytedance.com> | 2022-05-23 16:46:04 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2022-06-24 17:07:06 +0200 |
commit | ac1fc3a3a93ca57271e4ca6072aa340b30261d1e (patch) | |
tree | 9da4523e98f784cd2afafe782632f4360b9c8c88 /block/block-backend.c | |
parent | 618af89e559daf897cc5013d3476a9c41ee76e00 (diff) |
block: Support passing NULL ops to blk_set_dev_ops()
This supports passing NULL ops to blk_set_dev_ops()
so that we can remove stale ops in some cases.
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220523084611.91-2-xieyongji@bytedance.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/block-backend.c')
-rw-r--r-- | block/block-backend.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index d4abdf8faa..f425b00793 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1058,7 +1058,7 @@ void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, blk->dev_opaque = opaque; /* Are we currently quiesced? Should we enforce this right now? */ - if (blk->quiesce_counter && ops->drained_begin) { + if (blk->quiesce_counter && ops && ops->drained_begin) { ops->drained_begin(opaque); } } |