linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* i_generation consistency
@ 2002-11-26 10:11 David Chow
  2002-11-26 12:58 ` Neil Brown
  0 siblings, 1 reply; 4+ messages in thread
From: David Chow @ 2002-11-26 10:11 UTC (permalink / raw)
  To: linux-fsdevel, neilb

Hi Neil,

I am writing a file system and having problem implementing the 
i_generation of the inode. Should the i_generation be persistent in the 
disk? Or it has to be changed every time the dcache shrinks or reload 
after read_inode()? Should I check the i_generation in the fh_dentry() 
ops and include it in file handle or leave it to the NFS clients and 
nfsd and I should forget about implementing i_generation in file 
handles. Can you please clarify? Thanks.

regards,
David Chow


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

* Re: i_generation consistency
  2002-11-26 10:11 i_generation consistency David Chow
@ 2002-11-26 12:58 ` Neil Brown
  2002-11-28  6:28   ` David Chow
       [not found]   ` <3DE5B746.1040300@shaolinmicro.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Neil Brown @ 2002-11-26 12:58 UTC (permalink / raw)
  To: David Chow; +Cc: linux-fsdevel

On Tuesday November 26, davidchow@shaolinmicro.com wrote:
> Hi Neil,
> 
> I am writing a file system and having problem implementing the 
> i_generation of the inode. Should the i_generation be persistent in the 
> disk? Or it has to be changed every time the dcache shrinks or reload 
> after read_inode()? Should I check the i_generation in the fh_dentry() 
> ops and include it in file handle or leave it to the NFS clients and 
> nfsd and I should forget about implementing i_generation in file 
> handles. Can you please clarify? Thanks.

The core requirement is that dentry_to_fh must provide a
filehandle that fh_to_dentry can
  1/ recoginise and find, even if it isn't in cache
  2/ check that the inode that was found is still valid. i.e.
    that it hasn't been re-used after the original was deleted.

This is sometimes done using a combination of 
inode number, that can be used to locate a file, but that can be 
reused after a file is removed, and a generation number,
that is stored in the inode and has a different value each time the 
inode is reused (though this is not the only way to do it).

In this case, the generation number must be stored on stable
storage, and should be checked in fh_to_dentry.

Hope this helps.

NeilBrown

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

* Re: i_generation consistency
  2002-11-26 12:58 ` Neil Brown
@ 2002-11-28  6:28   ` David Chow
       [not found]   ` <3DE5B746.1040300@shaolinmicro.com>
  1 sibling, 0 replies; 4+ messages in thread
From: David Chow @ 2002-11-28  6:28 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-fsdevel



>>I am writing a file system and having problem implementing the 
>>i_generation of the inode. Should the i_generation be persistent in the 
>>disk? Or it has to be changed every time the dcache shrinks or reload 
>>after read_inode()? Should I check the i_generation in the fh_dentry() 
>>ops and include it in file handle or leave it to the NFS clients and 
>>nfsd and I should forget about implementing i_generation in file 
>>handles. Can you please clarify? Thanks.
>>    
>>
>
>The core requirement is that dentry_to_fh must provide a
>filehandle that fh_to_dentry can
>  1/ recoginise and find, even if it isn't in cache
>  2/ check that the inode that was found is still valid. i.e.
>    that it hasn't been re-used after the original was deleted.
>
>This is sometimes done using a combination of 
>inode number, that can be used to locate a file, but that can be 
>reused after a file is removed, and a generation number,
>that is stored in the inode and has a different value each time the 
>inode is reused (though this is not the only way to do it).
>
>In this case, the generation number must be stored on stable
>storage, and should be checked in fh_to_dentry.
>
>Hope this helps.
>
>NeilBrown
>
Thanks, it seems some file system change the i_generation each time the 
inode is read ... I don't think this is a good idea because the server 
can shrink the dcache and got the inode flushed, while the client keep 
that i_generation in its dcache. The next time the client requests that 
inode using the old i_generation and find it is stale. That means the 
lifetime of an i_generation is the same as the dcache which is not 
persistent. But from what you say is that the i_generation should be 
kept persistent until it is reused after a remove or delete, is my 
understanding right?

regards,
David


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

* Re: i_generation consistency
       [not found]   ` <3DE5B746.1040300@shaolinmicro.com>
@ 2002-12-01 23:00     ` Neil Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Brown @ 2002-12-01 23:00 UTC (permalink / raw)
  To: David Chow; +Cc: linux-fsdevel

On Thursday November 28, davidchow@shaolinmicro.com wrote:
> Thanks, it seems some file system change the i_generation each time the 
> inode is read ... I don't think this is a good idea because the server 
> can shrink the dcache and got the inode flushed, while the client keep 
> that i_generation in its dcache. The next time the client requests that 
> inode using the old i_generation and find it is stale. That means the 
> lifetime of an i_generation is the same as the dcache which is not 
> persistent. But from what you say is that the i_generation should be 
> kept persistent until it is reused after a remove or delete, is my 
> understanding right?

Yes, your understanding is correct.  If filesystems set i_generation
to something that is not stable, they would work well when exported
via knfsd.

NeilBrown

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

end of thread, other threads:[~2002-12-01 23:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-26 10:11 i_generation consistency David Chow
2002-11-26 12:58 ` Neil Brown
2002-11-28  6:28   ` David Chow
     [not found]   ` <3DE5B746.1040300@shaolinmicro.com>
2002-12-01 23:00     ` Neil Brown

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).