[linux-cifs-client] close-to-open cache consistency and cifs

Jeff Layton jlayton at redhat.com
Fri Dec 19 13:08:21 GMT 2008


One of the things that NFS implements is close-to-open cache
consistency. NFS flushes all pages to the server on close and then does
a GETATTR call to make sure the attribute cache is up to date. Then, on
open() it does another getattr to ensure that the file hasn't changed.
This allows it to avoid unnecessary cache invalidation. It also does
some similar things around posix locks so that they are also used as
cache consistency points.

I think we should shoot for implementing the same semantics in CIFS. To
do this though, we need to tighten up the behavior at close and open:

cifs_close has this:

                if (pTcon) {
                        /* no sense reconnecting to close a file that is
                           already closed */
                        if (!pTcon->need_reconnect) {
                                write_unlock(&GlobalSMBSeslock);
                                timeout = 2;
                                while ((atomic_read(&pSMBFile->wrtPending) != 0)

...I'm not sure that I agree with the "no sense" comment there. What if
there are still dirty pages? Should we turn all of that business into a
filemap_fdatawait (or just call cifs_fsync)?

-- 
Jeff Layton <jlayton at redhat.com>


More information about the linux-cifs-client mailing list