2008-08-29 13:45:06

by Ricardo Santos

[permalink] [raw]
Subject: directory attribute cache on NFS4 client

First, some info:

NFS4 Client: Fedora 9 - 2.6.25.9-76.fc9.i686
NFS4 Server: Fedora 9 - 2.6.25.6-55.fc9.i686
exportfs: rw,fsid=0,no_root_squash,async
mount: rw,bg,retry=1,timeo=30,rsize=8192,wsize=8192

Both on a local network

The Server act as a filer to a webhosting solution. I have 2 clients (FTP and
WebServer). When someone upload and overwrite a file on FTP, normally it do it:

- UPLOAD fileA.tmp
- DELETE fileA
- RENAME fileA.tmp fileA

This operation changes the inode for "fileA" and the WebServer doesn't see the
changes, still getting the old file (old inode).

After upload, if I do a "ls -la /path/path/fileA", it returns the old stats
(inode, mtime...). But if I do a "ls -la /path/path/" this will refresh info,
and get the file correctly.

I've tried the "acdirmin" and "acdirmax" defined to 0, but didn't work. I tried
too "noac", really works but the performance cost is expensive.

I really wouldn't like back to NFS3... :)



2008-09-01 16:40:19

by Ricardo Santos

[permalink] [raw]
Subject: Re: directory attribute cache on NFS4 client

I'm checking the NFS client code to understand it, and I saw this:

-- inode.c
int nfs_attribute_timeout(struct inode *inode)
{
struct nfs_inode *nfsi = NFS_I(inode);

if (nfs_have_delegation(inode, FMODE_READ))
return 0;

--

So, if a inode has a delegation, will it never be timed out, until the
delegation been free, right ?

If the delegated inode has been deleted ?


2008-09-02 17:50:50

by J. Bruce Fields

[permalink] [raw]
Subject: Re: directory attribute cache on NFS4 client

On Mon, Sep 01, 2008 at 04:40:04PM +0000, Ricardo Santos wrote:
> I'm checking the NFS client code to understand it, and I saw this:
>
> -- inode.c
> int nfs_attribute_timeout(struct inode *inode)
> {
> struct nfs_inode *nfsi = NFS_I(inode);
>
> if (nfs_have_delegation(inode, FMODE_READ))
> return 0;
>
> --
>
> So, if a inode has a delegation, will it never be timed out, until the
> delegation been free, right ?
>
> If the delegated inode has been deleted ?

The server should recall the delegation before allowing the delegated
file to be deleted. (The current linux server is buggy--it doesn't do
that. Patches are on the way soon, I hope....)

--b.

2008-09-02 19:52:31

by Ricardo Santos

[permalink] [raw]
Subject: Re: directory attribute cache on NFS4 client

Has anyway to disable delegations on Linux NFS Server ?

Thanks for help





2008-09-02 20:37:09

by david m. richter

[permalink] [raw]
Subject: Re: directory attribute cache on NFS4 client

On Tue, 2 Sep 2008, Ricardo Santos wrote:

> Has anyway to disable delegations on Linux NFS Server ?

yes, you can echo 0 to /proc/sys/fs/leases-enable

note that that disables all leases (atop which NFS delegations are
implemented).

d
.

>
> Thanks for help
>
>
>
>
> --
> 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
>

2008-09-03 02:58:08

by Ricardo Santos

[permalink] [raw]
Subject: Re: directory attribute cache on NFS4 client

> yes, you can echo 0 to /proc/sys/fs/leases-enable
>
> note that that disables all leases (atop which NFS delegations are
> implemented).

david, thanks for the tip. It really works for me!