File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,9 +22,12 @@ impl BufControl {
2222 }
2323
2424 pub fn pop ( & mut self ) -> io:: Result < u16 > {
25- self . queue
26- . pop_front ( )
27- . ok_or_else ( || io:: Error :: other ( "buffer ring has no available buffer" ) )
25+ self . queue . pop_front ( ) . ok_or_else ( || {
26+ io:: Error :: new (
27+ io:: ErrorKind :: ResourceBusy ,
28+ "buffer ring has no available buffer" ,
29+ )
30+ } )
2831 }
2932
3033 pub unsafe fn reset ( & mut self , buffer_id : u16 , _: BufPtr , _: u32 ) {
Original file line number Diff line number Diff line change @@ -462,7 +462,17 @@ fn create_entry(cq_entry: CEntry) -> Entry {
462462
463463fn create_result ( result : i32 ) -> io:: Result < usize > {
464464 if result < 0 {
465- Err ( io:: Error :: from_raw_os_error ( -result) )
465+ let err = io:: Error :: from_raw_os_error ( -result) ;
466+ // This is for ENOBUFS, which means io-uring report buffer pool has no available
467+ // buffer.
468+ if err. raw_os_error ( ) == Some ( libc:: ENOBUFS ) {
469+ Err ( io:: Error :: new (
470+ io:: ErrorKind :: ResourceBusy ,
471+ "buffer ring has no available buffer" ,
472+ ) )
473+ } else {
474+ Err ( err)
475+ }
466476 } else {
467477 Ok ( result as _ )
468478 }
You can’t perform that action at this time.
0 commit comments