From 69828814c2b34559f706009ced20433e2c1c0331 Mon Sep 17 00:00:00 2001 From: Dmitry Litvintsev Date: Tue, 20 Oct 2026 17:00:00 -0500 Subject: [PATCH] xrootd: improve handling of prepare options Motivation: ----------- Prepare evict option is passed via an extra option (optionX) according to the xrootd protool spec and may conflict with main options/actions passed via request options field. Modification: ------------ Improve prepare options hadling. If not options or extra options are specified - just return success. Handle contradicting options. Bump xrootd4j version number to pick up properly extracted kXR_evict option. Result: ------- Better protocol spec adherence. Target: trunk Request: 12.0, 11.2 Patch: https://rb.dcache.org/r/14811/ Acked-by: Tigran Require-book: no Require-notes: yes --- .../xrootd/door/XrootdRedirectHandler.java | 32 ++++++++++++------- pom.xml | 2 +- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/modules/dcache-xrootd/src/main/java/org/dcache/xrootd/door/XrootdRedirectHandler.java b/modules/dcache-xrootd/src/main/java/org/dcache/xrootd/door/XrootdRedirectHandler.java index 551c764fc21..93aa40153d5 100644 --- a/modules/dcache-xrootd/src/main/java/org/dcache/xrootd/door/XrootdRedirectHandler.java +++ b/modules/dcache-xrootd/src/main/java/org/dcache/xrootd/door/XrootdRedirectHandler.java @@ -1162,18 +1162,28 @@ protected XrootdResponse doOnPrepare(ChannelHandlerContext ctx, Restriction restriction = loginSessionInfo.getRestriction(); InetSocketAddress clientAddress = getSourceAddress(); - if (request.getOptions() == 0 - || (request.isStage() && !(request.isEvict() || request.isCancel()))) { - _door.pin(paths, clientAddress, subject, restriction); - return new PrepareResponse(request, kXR_ok, new byte[paths.length]); - } else if (request.isStage() && (request.isEvict() || request.isCancel())) { - throw new XrootdException(kXR_InvalidRequest, - "Invalid parameters / conflicting options"); - } else if (request.isCancel() || request.isEvict()) { - _door.unpin(paths, subject, restriction); - return new PrepareResponse(request, kXR_ok, new byte[paths.length]); + // if no options specified just return success + + if (request.getOptions() == 0 && request.getOptionX() == 0) { + return new PrepareResponse(request, + kXR_ok, new byte[paths.length]); + } + + if (request.isStage()) { + if (request.isEvict() || request.isCancel()) { + throw new XrootdException(kXR_InvalidRequest, + "Invalid parameters / conflicting options"); + } else { + _door.pin(paths, clientAddress, subject, restriction); + return new PrepareResponse(request, kXR_ok, new byte[paths.length]); + } } else { - throw new XrootdException(kXR_Unsupported, "Unsupported option(s)"); + if (request.isCancel() || request.isEvict()) { + _door.unpin(paths, subject, restriction); + return new PrepareResponse(request, kXR_ok, new byte[paths.length]); + } else { + throw new XrootdException(kXR_Unsupported, "Unsupported option(s)"); + } } } catch (PermissionDeniedCacheException e) { throw xrootdException(e); diff --git a/pom.xml b/pom.xml index 84b8e89e923..925887c7543 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ 7.6.0 2.12.0 9.4.57.v20241219 - 4.6.5 + 4.6.6 2.47 3.0.0 3.0.0