@@ -607,7 +607,15 @@ fio_close(int fd)
607
607
fio_fdset &= ~(1 << hdr .handle );
608
608
609
609
IO_CHECK (fio_write_all (fio_stdout , & hdr , sizeof (hdr )), sizeof (hdr ));
610
- /* Note, that file is closed without waiting for confirmation */
610
+
611
+ /* Wait for response */
612
+ IO_CHECK (fio_read_all (fio_stdin , & hdr , sizeof (hdr )), sizeof (hdr ));
613
+
614
+ if (hdr .arg != 0 )
615
+ {
616
+ errno = hdr .arg ;
617
+ return -1 ;
618
+ }
611
619
612
620
return 0 ;
613
621
}
@@ -617,6 +625,22 @@ fio_close(int fd)
617
625
}
618
626
}
619
627
628
+ /* Close remote file implementation */
629
+ static void
630
+ fio_close_impl (int fd , int out )
631
+ {
632
+ fio_header hdr ;
633
+
634
+ hdr .cop = FIO_CLOSE ;
635
+ hdr .arg = 0 ;
636
+
637
+ if (close (fd ) != 0 )
638
+ hdr .arg = errno ;
639
+
640
+ /* send header */
641
+ IO_CHECK (fio_write_all (out , & hdr , sizeof (hdr )), sizeof (hdr ));
642
+ }
643
+
620
644
/* Truncate stdio file */
621
645
int
622
646
fio_ftruncate (FILE * f , off_t size )
@@ -3000,7 +3024,7 @@ fio_communicate(int in, int out)
3000
3024
IO_CHECK (fio_write_all (out , & hdr , sizeof (hdr )), sizeof (hdr ));
3001
3025
break ;
3002
3026
case FIO_CLOSE : /* Close file */
3003
- SYS_CHECK ( close ( fd [hdr .handle ]) );
3027
+ fio_close_impl ( fd [hdr .handle ], out );
3004
3028
break ;
3005
3029
case FIO_WRITE : /* Write to the current position in file */
3006
3030
// IO_CHECK(fio_write_all(fd[hdr.handle], buf, hdr.size), hdr.size);
0 commit comments