Curiosities of Linux NFSD file handles
Subsystems (3)
I've been poking around in the exportfs code, and I see that the handle decode routines seem to expect that they may be given more data for a handle than the encode_fh() routine produced.
Is this still true? Or can I assume that the amount of data now given to the decoder will exactly reflect the amount of data obtained from the encoder?
David
Quoted 4 lines · David Howells
I've been poking around in the exportfs code, and I see that the handle decode routines seem to expect that they may be given more data for a handle than the
encode_fh()routine produced.
Somebody else who understands what you're asking about off the top of their heads may be able to pop up and answer this. But I'm a little confused. Which encode/decode routines exactly, and where do you see them making assumptions about the size of the data?
--b.
Quoted 2 lines
Is this still true? Or can I assume that the amount of data now given to the decoder will exactly reflect the amount of data obtained from the encoder?
Quoted 8 lines · J. Bruce Fields
Quoted 6 lines · David Howells
I've been poking around in the exportfs code, and I see that the handle decode
routines seem to expect that they may be given more data for a handle than theencode_fh()routine produced.
Quoted 5 lines
Somebody else who understands what you're asking about off the top of their heads may be able to pop up and answer this. But I'm a little confused. Which encode/decode routines exactly, and where do you see them making assumptions about the size of the data?
I'm with Bruce here - what exactly do you mean?
The decode routine cannot assume anything about the filehandle as it was received from the network and so is inherently untrustworthy. However if it finds anything that it did not expect (i.e. that encode could not have generated) then it is free to return an error.
NeilBrown
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · J. Bruce Fields
Quoted 3 lines
I've been poking around in the exportfs code, and I see that the handle decode routines seem to expect that they may be given more data for a handle than the
encode_fh()routine produced.Somebody else who understands what you're asking about off the top of their heads may be able to pop up and answer this. But I'm a little confused. Which encode/decode routines exactly, and where do you see them making assumptions about the size of the data?
The encode_fh() operation produces a blob of data and passes back the type and length of this data.
The fh_to_dentry() and fh_to_parent() routines are given back the blob of data, the handle type and a length, where the length, it would appear, may be longer than that passed back by encode_fh(). To quote from the Exporting document:
The decode_fh routine should not depend on the stated size that is passed to it. This size may be larger than the original filehandle generated by encode_fh, in which case it will have been padded with nuls. Rather, the encode_fh routine should choose a "type" which indicates the decode_fh how much of the filehandle is valid, and how
Is this still true?
If it isn't true, then there's no need for separate FILEID_INO32_GEN and FILEID_INO32_GEN_PARENT types. If it is true, then FILEID_INO32_GEN_PARENT and the generic routines that handle it are perhaps dodgy as they assume they can simply set i_generation to 0 if the file handle is short.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html