Re: [PATCH 2/2] btrfs: increment ctx->pos for every emitted or skipped dirent in readdir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 05, 2016 at 01:26:35PM -0400, jeffm@xxxxxxxx wrote:
> From: Jeff Mahoney <jeffm@xxxxxxxx>
> 
> If we process the last item in the leaf and hit an I/O error while
> reading the next leaf, we return -EIO without having adjusted the
> position.  Since we have emitted dirents, getdents() will return
> the byte count to the user instead of the error.  Subsequent callers
> will emit the last successful dirent again, and return -EIO again,
> with the same result.  Callers loop forever.
> 
> Instead, if we always increment ctx->pos after emitting or skipping
> the dirent, we'll be sure that we won't hit the same one again.  When
> we go to process the next leaf, we won't have emitted any dirents
> and the -EIO will be returned to the user properly.  We also don't
> need to track if we've emitted a dirent already or if we've changed
> the position yet.
> 
> Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx>

Reviewed-by: David Sterba <dsterba@xxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux