Re: [PATCH 1/2] btrfs-progs: Avoid reading bad fd in case of missing device.

2015-08-25 Thread David Sterba
On Fri, Aug 21, 2015 at 11:21:26AM +0800, Qu Wenruo wrote: > Offline btrfs tools, like btrfs-image, will infinitely loop when there > is missing device. > > The reason is, for missing device, it's fd will be set to -1, but before > we reading, we only check the fd validation by checking if it's 0.

[PATCH 1/2] btrfs-progs: Avoid reading bad fd in case of missing device.

2015-08-20 Thread Qu Wenruo
Offline btrfs tools, like btrfs-image, will infinitely loop when there is missing device. The reason is, for missing device, it's fd will be set to -1, but before we reading, we only check the fd validation by checking if it's 0. So in that case, -1 will pass the validation check, and cause pread