### CI Link

https://gradle-enterprise.elastic.co/s/vn4gmfzui5s3q

### Repro line

NONE

### Does it reproduce?

Didn't try

### Applicable branches

master, 8.2

### Failure history

_No response_

### Failure excerpt

```
java.lang.AssertionError: expected file size 16777216 but was 0 |  
-- | --
  | »  	at org.elasticsearch.xpack.searchablesnapshots.cache.shared.SharedBytes.<init>(SharedBytes.java:64) |  
  | »  	at org.elasticsearch.xpack.searchablesnapshots.cache.shared.FrozenCacheService.<init>(FrozenCacheService.java:295) |  
  | »  	at org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.createComponents(SearchableSnapshots.java:339) |  
  | »  	at org.elasticsearch.node.Node.lambda$new$16(Node.java:685) |  
  | »  	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273) |  
  | »  	at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720) |  
  | »  	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) |  
  | »  	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) |  
  | »  	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) |  
  | »  	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) |  
  | »  	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) |  
  | »  	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) |  
  | »  	at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) |  
  | »  	at org.elasticsearch.node.Node.<init>(Node.java:699) |  
  | »  	at org.elasticsearch.node.Node.<init>(Node.java:291) |  
  | »  	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:234) |  
  | »  	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) |  
  | »  	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:358) |  
  | »  	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) |  
  | »  	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) |  
  | »  	at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:81) |  
  | »  	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) |  
  | »  	at org.elasticsearch.cli.Command.main(Command.java:77) |  
  | »  	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) |  
  | »  	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)


```
x-pack/plugin/searchable-snapshots/preallocate/src/main/java/org/elasticsearch/xpack/searchablesnapshots/preallocate/Preallocate.java
private static final Logger logger = LogManager.getLogger(Preallocate.class);
    public static void preallocate(final Path cacheFile, final long fileSize) throws IOException {
        if (Constants.LINUX) {
            preallocate(cacheFile, fileSize, new LinuxPreallocator());
        } else if (Constants.MAC_OS_X) {
            preallocate(cacheFile, fileSize, new MacOsPreallocator());
        } else {
            preallocate(cacheFile, fileSize, new NoNativePreallocator());
        }
    }
    @SuppressForbidden(reason = "need access to fd on FileOutputStream")
    private static void preallocate(final Path cacheFile, final long fileSize, final Preallocator prealloactor) throws IOException {
        boolean success = false;
        try {
            if (prealloactor.useNative()) {
                try (FileOutputStream fileChannel = new FileOutputStream(cacheFile.toFile())) {
                    long currentSize = fileChannel.getChannel().size();