Skip to content

Commit 960bad8

Browse files
committed
nfs4: set filesize on open if specified
Motivation: In some cases, on create, clients might specify file's initial size. Currently we support only zero size, which lets some synthetic test to fail. Modification: Update OperationOPEN to set file size on create if specified. Result: Better spec compliance. NOTE: as POSIX doesn't provide such functionality to applications, this functionality use by special clients only. Acked-by: Karen Hoyos Target: master
1 parent ad8f569 commit 960bad8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/src/main/java/org/dcache/nfs/v4/OperationOPEN.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,12 @@ public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNF
169169
res.resok4.attrset.set(nfs4_prot.FATTR4_MODE);
170170
}
171171

172-
if (createSize.isPresent() && createSize.get().value == 0) {
172+
if (createSize.isPresent()) {
173+
if (createSize.get().value != 0) {
174+
var newSizeStat = new Stat();
175+
newSizeStat.setSize(createSize.get().value);
176+
context.getFs().setattr(inode, newSizeStat);
177+
}
173178
res.resok4.attrset.set(nfs4_prot.FATTR4_SIZE);
174179
}
175180

0 commit comments

Comments
 (0)