Linux NFS development
 help / color / mirror / Atom feed
* Cache flushing
@ 2007-11-17  0:11 Timo Sirainen
  2007-11-17 19:46 ` [NFS] " Trond Myklebust
  0 siblings, 1 reply; 18+ messages in thread
From: Timo Sirainen @ 2007-11-17  0:11 UTC (permalink / raw)
  To: nfs


[-- Attachment #1.1: Type: text/plain, Size: 1679 bytes --]

Solaris and BSDs support flushing attribute cache safely using
fchown(fd, (uid_t)-1, (gid_t)-1). Could Linux be changed to support this
as well? If I'm looking at the sources right, this might work
(completely untested):

--- inode.c.old 2007-11-16 22:18:46.000000000 +0200
+++ inode.c     2007-11-16 22:19:44.000000000 +0200
@@ -322,6 +322,7 @@
 nfs_setattr(struct dentry *dentry, struct iattr *attr)
 {
        struct inode *inode = dentry->d_inode;
+       struct nfs_inode *nfsi = NFS_I(inode);
        struct nfs_fattr fattr;
        int error;
 
@@ -334,8 +335,10 @@
 
        /* Optimization: if the end result is no change, don't RPC */
        attr->ia_valid &= NFS_VALID_ATTRS;
-       if (attr->ia_valid == 0)
+       if (attr->ia_valid == 0) {
+               nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
                return 0;
+       }
 
        lock_kernel();
        nfs_begin_data_update(inode);

Another problem I have is that it's difficult to get a file's data cache
flushed. The only way I found was to successfully fcntl() lock the file.
This is pretty bad from performance point of view since often I don't
want/need to lock the file.

Solaris and BSDs invalidate also a file's data cache when its attribute
cache is invalidated. It would be nicer if there was a separate way, but
I'd settle for fchown(fd, (uid_t)-1, (gid_t)-1) invalidating data cache
as well.

Actually I did also look at posix_fadvise(fd, 0, 0,
POSIX_FADVN_DONTNEED). It appears to work, but I'm a bit worried about
race conditions that causes pages to randomly not get dropped because
invalidate_mapping_pages() doesn't drop locked pages.

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #3: Type: text/plain, Size: 362 bytes --]

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
_______________________________________________
Please note that nfs@lists.sourceforge.net is being discontinued.
Please subscribe to linux-nfs@vger.kernel.org instead.
    http://vger.kernel.org/vger-lists.html#linux-nfs

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

end of thread, other threads:[~2007-11-22  0:52 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-17  0:11 Cache flushing Timo Sirainen
2007-11-17 19:46 ` [NFS] " Trond Myklebust
     [not found]   ` <1195328785.6999.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-11-17 20:12     ` Timo Sirainen
2007-11-17 20:41       ` Trond Myklebust
     [not found]         ` <1195332062.6999.20.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-11-17 22:11           ` Timo Sirainen
2007-11-17 23:52             ` Trond Myklebust
     [not found]               ` <1195343531.7084.11.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-11-18  0:26                 ` Timo Sirainen
2007-11-18  0:46                   ` Trond Myklebust
     [not found]                     ` <1195346790.8908.0.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-11-18  2:03                       ` Timo Sirainen
2007-11-20  2:14             ` Timo Sirainen
2007-11-20 23:47               ` Trond Myklebust
     [not found]                 ` <1195602454.7234.100.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2007-11-21 13:14                   ` Timo Sirainen
2007-11-21 13:56                     ` Trond Myklebust
     [not found]                       ` <1195653389.8374.4.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2007-11-21 20:36                         ` Timo Sirainen
2007-11-21 20:39                           ` Trond Myklebust
     [not found]                             ` <1195677569.8374.18.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2007-11-21 20:56                               ` Timo Sirainen
2007-11-21 21:15                                 ` Trond Myklebust
     [not found]                                   ` <1195679737.8374.34.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2007-11-22  0:52                                     ` Timo Sirainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox