>majianpeng <majianp...@gmail.com> writes: > >> For async-write on block device,if device removed,but the vfs don't know it. >> It will continue to do. >> Patch1 set size of inode of block device to zero when removed disk.By >> this,vfs know >> disk changed. >> Path2 add size-check on blk_aio_write.If pos of write larger than size of >> inode,it will >> return zero.So the user can check disk state. > >OK, so the basic problem is that __generic_file_aio_write will always >return 0 after device removal, yes? I'm not sure why that's a real >issue, can you explain exactly why you're trying to change this? > At prenset, the __generic_file_aio_write don't return zero rather that the wanted size. So the user can't know the disk removed. For example: dd if=/dev/zero of=usb-disk bs=64k When removed usb-disk, dd stoped until reached the endof usb-disk.
Using this patch, after removed disk, the aio-write will return zero.I think the upper user will check. (or if the size of block is zero, we return -ENOSPC). >As for your patches, I don't think that putting the i_size_write into >invalidate_partitions is a good idea. Consider the case of rescanning >partitions: you will always detect a size change now, which is not good. > Yes.But in func rescan_partitions, after invalidate_partitions it will call check_disk_size_change to set size of block_device. Thanks! Jianpeng Ma >Cheers, >JeffN�Р骒r��y����b�X�肚�v�^�)藓{.n�+�伐�{��赙zXФ�≤�}��财�z�&j:+v�����赙zZ+��+zf"�h���~����i���z��wア�?�ㄨ��&�)撷f��^j谦y�m��@A�a囤� >0鹅h���i