]> Cypherpunks repositories - gostls13.git/commit
os: fix RemoveAll hangs on large directory
authorLE Manh Cuong <cuong.manhle.vn@gmail.com>
Sun, 7 Apr 2019 06:56:58 +0000 (13:56 +0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 10 Apr 2019 20:14:25 +0000 (20:14 +0000)
commitc3495058786a3c05699f0d4a39ecc7df39e58897
tree23045db3186454df6e26662dcd7f9578fcedf44d
parenta6af1041f6889fddd71c2a08308f52637b3f345d
os: fix RemoveAll hangs on large directory

golang.org/cl/121255 added close and re-open the directory when looping, prevent
us from missing some if previous iteration deleted files.

The CL introdued a bug. If we can not delete all entries in one request,
the looping never exits, causing RemoveAll hangs.

To fix that, simply discard the entries if we can not delete all of them
in one iteration, then continue reading entries and delete them.

Also make sure removeall_at return first error it encounters.

Fixes #29921

Change-Id: I8ec3a4c822d8d2d95d9f1ab71547879da395bc4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/171099
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/export_test.go
src/os/path.go
src/os/removeall_at.go
src/os/removeall_noat.go
src/os/removeall_test.go