linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Curiosities of Linux NFSD file handles
@ 2008-12-04 16:46 David Howells
  2008-12-04 19:35 ` J. Bruce Fields
       [not found] ` <20081204193511.GE7575-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
  0 siblings, 2 replies; 4+ messages in thread
From: David Howells @ 2008-12-04 16:46 UTC (permalink / raw)
  To: J. Bruce Fields, Neil Brown
  Cc: dhowells, Christoph Hellwig, linux-fsdevel, linux-nfs


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Curiosities of Linux NFSD file handles
  2008-12-04 16:46 Curiosities of Linux NFSD file handles David Howells
@ 2008-12-04 19:35 ` J. Bruce Fields
  2008-12-04 22:28   ` NeilBrown
       [not found] ` <20081204193511.GE7575-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: J. Bruce Fields @ 2008-12-04 19:35 UTC (permalink / raw)
  To: David Howells; +Cc: Neil Brown, Christoph Hellwig, linux-fsdevel, linux-nfs

On Thu, Dec 04, 2008 at 04:46:57PM +0000, David Howells wrote:
> 
> 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.

> 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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Curiosities of Linux NFSD file handles
  2008-12-04 19:35 ` J. Bruce Fields
@ 2008-12-04 22:28   ` NeilBrown
  0 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2008-12-04 22:28 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: David Howells, Christoph Hellwig, linux-fsdevel, linux-nfs

On Fri, December 5, 2008 6:35 am, J. Bruce Fields wrote:
> On Thu, Dec 04, 2008 at 04:46:57PM +0000, David Howells wrote:
>>
>> 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?
>

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Curiosities of Linux NFSD file handles
       [not found] ` <20081204193511.GE7575-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
@ 2008-12-05  9:07   ` David Howells
  0 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2008-12-05  9:07 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA, Neil Brown, Christoph Hellwig,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA

J. Bruce Fields <bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org> wrote:

> > 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-05  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-04 16:46 Curiosities of Linux NFSD file handles David Howells
2008-12-04 19:35 ` J. Bruce Fields
2008-12-04 22:28   ` NeilBrown
     [not found] ` <20081204193511.GE7575-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2008-12-05  9:07   ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).