[ARVADOS] updated: 2.3.1-10-gb008c44ea

Git user git at public.arvados.org
Tue Dec 7 00:39:43 UTC 2021


Summary of changes:
 services/keepstore/unix_volume.go | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

       via  b008c44eaf5c6b45c9f36116601918748aeb8323 (commit)
      from  51c1bbb2f68e1046e8684985935fce932df08667 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit b008c44eaf5c6b45c9f36116601918748aeb8323
Author: Tom Clegg <tom at curii.com>
Date:   Thu Nov 18 14:31:01 2021 -0500

    18376: Retry up to 4 times on EBADCOOKIE from readdir.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keepstore/unix_volume.go b/services/keepstore/unix_volume.go
index 46f4db409..a053ba3e6 100644
--- a/services/keepstore/unix_volume.go
+++ b/services/keepstore/unix_volume.go
@@ -379,23 +379,25 @@ func (v *UnixVolume) IndexTo(prefix string, w io.Writer) error {
 			continue
 		}
 		blockdirpath := filepath.Join(v.Root, subdir)
-		blockdir, err := v.os.Open(blockdirpath)
-		if err != nil {
-			v.logger.WithError(err).Errorf("error reading %q", blockdirpath)
-			return fmt.Errorf("error reading %q: %s", blockdirpath, err)
-		}
-		v.os.stats.TickOps("readdir")
-		v.os.stats.Tick(&v.os.stats.ReaddirOps)
-		// ReadDir() (compared to Readdir(), which returns
-		// FileInfo structs) helps complete the sequence of
-		// readdirent calls as quickly as possible, reducing
-		// the likelihood of NFS EBADCOOKIE (523) errors.
-		dirents, err := blockdir.ReadDir(-1)
-		blockdir.Close()
-		if err != nil {
-			v.logger.WithError(err).Errorf("error reading %q", blockdirpath)
-			return fmt.Errorf("error reading %q: %s", blockdirpath, err)
+
+		var dirents []os.DirEntry
+		for attempt := 0; ; attempt++ {
+			v.os.stats.TickOps("readdir")
+			v.os.stats.Tick(&v.os.stats.ReaddirOps)
+			dirents, err = os.ReadDir(blockdirpath)
+			if err == nil {
+				break
+			} else if attempt < 5 && strings.Contains(err.Error(), "errno 523") {
+				// EBADCOOKIE (NFS stopped accepting
+				// our readdirent cookie) -- retry a
+				// few times before giving up
+				v.logger.WithError(err).Printf("retry after error reading %s", blockdirpath)
+				continue
+			} else {
+				return err
+			}
 		}
+
 		for _, dirent := range dirents {
 			fileInfo, err := dirent.Info()
 			if os.IsNotExist(err) {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list