diff --git a/pageserver/src/virtual_file/owned_buffers_io/write/flush.rs b/pageserver/src/virtual_file/owned_buffers_io/write/flush.rs index 282afd4f9f..c076ba0eca 100644 --- a/pageserver/src/virtual_file/owned_buffers_io/write/flush.rs +++ b/pageserver/src/virtual_file/owned_buffers_io/write/flush.rs @@ -20,11 +20,6 @@ pub struct FlushHandleInner { /// A bi-directional channel that sends (buffer, offset) for writes, /// and receives recyled buffer. channel: duplex::mpsc::Duplex, FullSlice>, - /// The flush task is sometimes sensitive to channel disconnection - /// (i.e. when we drop [`Self::channel`]), other times sensitive to - /// [`FlushBackgroundTask::cancel`], but never both. - /// So, also store this drop guard. - set_flush_task_cancelled: tokio_util::sync::DropGuard, /// Join handle for the background flush task. join_handle: tokio::task::JoinHandle, FlushTaskError>>, } @@ -139,10 +134,8 @@ where back.try_send(buf.flush()) .expect("we just created it with capacity 1"); - let cancel = cancel.child_token(); - let join_handle = tokio::spawn( - FlushBackgroundTask::new(back, file, gate_guard, cancel.clone(), ctx) + FlushBackgroundTask::new(back, file, gate_guard, cancel, ctx) .run() .instrument(span), ); @@ -150,7 +143,6 @@ where FlushHandle { inner: Some(FlushHandleInner { channel: front, - set_flush_task_cancelled: cancel.drop_guard(), join_handle, }), } @@ -197,7 +189,6 @@ where .take() .expect("must not use after we returned an error"); drop(handle.channel.tx); - drop(handle.set_flush_task_cancelled); handle.join_handle.await.unwrap() }