Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2018-10-17 12:34:29 +0300
committerJacob Vosmaer <jacob@gitlab.com>2018-10-17 12:34:29 +0300
commit4960bdcd4462b3718523300636826c2f3179b42d (patch)
tree47523bac8570f6a3d22de39a81ebd4cacfb9a47d
parent378ee4e95db71c16e44d2b434b9277264f288552 (diff)
parent6c9e863263ca89a8b272902a61de2db0be67a7d8 (diff)
Merge branch 'sh-add-nfs-workaround' into 'master'
Prevent stale packed-refs file when Gitaly is running on top of NFS Closes #1339 See merge request gitlab-org/gitaly!924
-rw-r--r--changelogs/unreleased/sh-add-nfs-workaround.yml5
-rw-r--r--internal/helper/repo.go10
2 files changed, 15 insertions, 0 deletions
diff --git a/changelogs/unreleased/sh-add-nfs-workaround.yml b/changelogs/unreleased/sh-add-nfs-workaround.yml
new file mode 100644
index 000000000..014318e3a
--- /dev/null
+++ b/changelogs/unreleased/sh-add-nfs-workaround.yml
@@ -0,0 +1,5 @@
+---
+title: Prevent stale packed-refs file when Gitaly is running on top of NFS
+merge_request: 924
+author:
+type: other
diff --git a/internal/helper/repo.go b/internal/helper/repo.go
index 46a3cfca2..5397b2fca 100644
--- a/internal/helper/repo.go
+++ b/internal/helper/repo.go
@@ -81,5 +81,15 @@ func IsGitDirectory(dir string) bool {
}
}
+ // See: https://gitlab.com/gitlab-org/gitaly/issues/1339
+ //
+ // This is a workaround for Gitaly running on top of an NFS mount. There
+ // is a Linux NFS v4.0 client bug where opening the packed-refs file can
+ // either result in a stale file handle or stale data. This can happen if
+ // git gc runs for a long time while keeping open the packed-refs file.
+ // Running stat() on the file causes the kernel to revalidate the cached
+ // directory entry. We don't actually care if this file exists.
+ os.Stat(path.Join(dir, "packed-refs"))
+
return true
}