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;
// 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);
// 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.