Skip to contentSkip to conversation

xdr_stream interface oddities with pages vs stream

DISCUSSION Mike Snitzer 2 participants 3 messages Dec 16, 2025 – Dec 18, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I've been working on enhancing the NFS client and server such that nfs4_{set,set}acl utilities to set/get 4.0 ACLs will work when NFSD v4.1 is reexporting NFS v4.2. Its soul sucking, but that aside...

In my journey I'm finding that xdr_stream_decode_u32() followed by xdr_stream_subsegment() doesn't continue from the point where xdr_stream_decode_u32() advanced xdr_stream's ->p

xdr_stream_subsegment() doesn't appear in any way interlocked with the pages offset (->p), it starts with xdr_stream_pos() but ends with advancing ->p. So xdr_stream_subsegment() does what it should, I'm concerned about interfaces like xdr_stream_decode_u32() not advancing xdr->nwords

Shouldn't both the xdr->p and xdr->nwords be interlocked? SO that xdr_stream_subsegment() continues from the point where xdr_stream_decode_u32() advanced the stream?

Could this possibly be a regression due to more recent scratch buffer changes?

Anyway.. I'm stabbing/fishing here and hoping someone else knows how things _should_ work.

Thanks,
Mike

ps. I can expound on what I'm seeing, I just don't want to bury people right out of the gate ;)

maintainer
#1 lore raw
Quoted 16 lines · Mike Snitzer

Hi,

I've been working on enhancing the NFS client and server such that nfs4_{set,set}acl utilities to set/get 4.0 ACLs will work when NFSD v4.1 is reexporting NFS v4.2. Its soul sucking, but that aside...

In my journey I'm finding that xdr_stream_decode_u32() followed by xdr_stream_subsegment() doesn't continue from the point where xdr_stream_decode_u32() advanced xdr_stream's ->p

xdr_stream_subsegment() doesn't appear in any way interlocked with the pages offset (->p), it starts with xdr_stream_pos() but ends with advancing ->p. So xdr_stream_subsegment() does what it should, I'm concerned about interfaces like xdr_stream_decode_u32() not advancing xdr->nwords

Quoted 3 lines

Shouldn't both the xdr->p and xdr->nwords be interlocked? SO that xdr_stream_subsegment() continues from the point where xdr_stream_decode_u32() advanced the stream?

From the wasteland that is my memory... I think only one side uses nwords, and I'm betting it's the encode side. These aren't exactly symmetrical APIs, and the differences can be subtle.

Quoted 11 lines

Could this possibly be a regression due to more recent scratch buffer changes?

Anyway.. I'm stabbing/fishing here and hoping someone else knows how things _should_ work.

Thanks,
Mike

ps. I can expound on what I'm seeing, I just don't want to bury people right out of the gate ;)

Signature · 1 line
Chuck Lever
#2 lore raw
Quoted 19 lines · Chuck Lever
Quoted 16 lines · Mike Snitzer

Hi,

I've been working on enhancing the NFS client and server such that nfs4_{set,set}acl utilities to set/get 4.0 ACLs will work when NFSD v4.1 is reexporting NFS v4.2. Its soul sucking, but that aside...

In my journey I'm finding that xdr_stream_decode_u32() followed by xdr_stream_subsegment() doesn't continue from the point where xdr_stream_decode_u32() advanced xdr_stream's ->p

xdr_stream_subsegment() doesn't appear in any way interlocked with the pages offset (->p), it starts with xdr_stream_pos() but ends with advancing ->p. So xdr_stream_subsegment() does what it should, I'm concerned about interfaces like xdr_stream_decode_u32() not advancing xdr->nwords

Quoted 7 lines
Quoted 3 lines

Shouldn't both the xdr->p and xdr->nwords be interlocked? SO that xdr_stream_subsegment() continues from the point where xdr_stream_decode_u32() advanced the stream?

From the wasteland that is my memory... I think only one side uses nwords, and I'm betting it's the encode side. These aren't exactly symmetrical APIs, and the differences can be subtle.

It was just user error on my part.. (I had expected the acl_pages to be aligned at the start of the first page in the subsegment I extracted, but it was offset within that first page).

Move along nothing to see here! ;)

Thannks,
Mike