2012-12-19 14 views
5

Devo trovare un modo per svuotare la cache degli attributi NFS sul lato client. la chiamata stat() legge ctime dalla cache degli attributi e non il valore effettivo, impiega fino a 3 secondi affinché il valore effettivo venga riflesso nella cache. utilizzando l'opzione 'noac' quando il montaggio funziona ma influenzerà le prestazioni a lungo termine.Come svuotare la cache degli attributi nfs?

Mi sono imbattuto in soluzioni come fare un chown sullo stesso proprietario del file ecc. Ma c'è un metodo corretto per svuotare la cache degli attributi prima di fare una stat()? e questo problema si verifica solo su RedHat Linux e non su FreeBSD. Qualcuno può spiegare?

+0

Quale versione RedHat stai usando? Forse è un bug e faresti meglio a segnalarlo. Potresti riempire un bug su [redhat's bugzilla] (https://bugzilla.redhat.com/) –

risposta

2

Questo non è specifico per NFS, ma è possibile avere le cache di rilascio del kernel. Questo di solito viene fatto durante l'analisi comparativa IO, ma funziona anche per NFS.

https://www.kernel.org/doc/Documentation/sysctl/vm.txt:

Writing to this will cause the kernel to drop clean caches, dentries and 
inodes from memory, causing that memory to become free. 

To free pagecache: 
    echo 1 > /proc/sys/vm/drop_caches 
To free dentries and inodes: 
    echo 2 > /proc/sys/vm/drop_caches 
To free pagecache, dentries and inodes: 
    echo 3 > /proc/sys/vm/drop_caches 

As this is a non-destructive operation and dirty objects are not freeable, the 
user should run `sync' first. 
Problemi correlati