diff options
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java index 29f936587d..d6c25b2587 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java @@ -56,6 +56,7 @@ import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectLoader; +import org.eclipse.jgit.util.FileUtils; import org.eclipse.jgit.util.LongList; import org.eclipse.jgit.util.NB; import org.eclipse.jgit.util.RawParseUtils; @@ -665,7 +666,12 @@ public class Pack implements Iterable<PackIndex.MutableEntry> { // exceptions signaling permanent problems with a pack openFail(true, pe); throw pe; - } catch (IOException | RuntimeException ge) { + } catch (IOException ioe) { + // mark this packfile as invalid when NFS stale file handle error + // occur + openFail(FileUtils.isStaleFileHandleInCausalChain(ioe), ioe); + throw ioe; + } catch (RuntimeException ge) { // generic exceptions could be transient so we should not mark the // pack invalid to avoid false MissingObjectExceptions openFail(false, ge); @@ -1134,6 +1140,14 @@ public class Pack implements Iterable<PackIndex.MutableEntry> { // removed index, packfile or the bitmap bitmapIdxFile = null; return null; + } catch (IOException e) { + if (!FileUtils.isStaleFileHandleInCausalChain(e)) { + throw e; + } + // Ignore NFS stale handle exception the same way as + // FileNotFoundException above. + bitmapIdxFile = null; + return null; } // At this point, idx() will have set packChecksum. |