Re: [PATCH 3/3] NFS: Detect loops in a readdir due to bad cookies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 23 Mar 2011 17:36:38 -0400 <Daniel.Muntz@xxxxxxx> wrote:

>  
> 
> > -----Original Message-----
> > From: linux-nfs-owner@xxxxxxxxxxxxxxx 
> > [mailto:linux-nfs-owner@xxxxxxxxxxxxxxx] On Behalf Of NeilBrown
> > Sent: Wednesday, March 23, 2011 2:28 PM
> > To: Trond Myklebust
> > Cc: Staubach, Peter; bfields@xxxxxxxxxxxx; 
> > bjschuma@xxxxxxxxxx; linux-nfs@xxxxxxxxxxxxxxx
> > Subject: Re: [PATCH 3/3] NFS: Detect loops in a readdir due 
> > to bad cookies
> > 
> > On Wed, 23 Mar 2011 14:48:35 -0400 Trond Myklebust
> > <Trond.Myklebust@xxxxxxxxxx> wrote:
> > 
> > > On Wed, 2011-03-23 at 14:42 -0400, peter.staubach@xxxxxxx wrote:
> > > > Although I think that it is a good thing to protect the 
> > client against broken servers, it does seem like the right 
> > solution is to get the server fixed...
> > > 
> > > Don't get me wrong: I fully agree with that!
> > 
> > Ack.
> > 
> > As I understand it, ext4 (and ext3) use the hash of the 
> > basename as the
> > cookie.  This hash has a per-directory random seed which is 
> > hidden so it is
> > not possible to deliberately create files with the same hash, 
> > but thanks to
> > the birthday paradox it isn't too hard to get collisions in a 
> > suitably large
> > directory.
> > 
> > For 'readdir' ext4 keeps extra state in the 'struct file' so 
> > that it knows
> > where it was up to in a list of names with the same hash and 
> > so won't return
> > duplicates.  
> 
> Would it be possible to use this "extra state" to uniqify the cookie used by NFS?  Having no idea what this extra state is, I'm just wildly speculating.
> 

No, it is all hidden inside filp->private_data.  It is just a linked-list of
file names  (see 'extra_fname' in fs/ext4/dir.c).
The best you could do would be to shift the cookie up a few bits (ext4
cookies are 62 bit already!) and add a sequence counter.
But I don't think that approach will really give more reliability than just
trying to hide cookie-runs by making sure they don't cross from one packet to
the next.

NeilBrown
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux