diff options
author | Trond Myklebust <trond.myklebust@fys.uio.no> | 2005-01-04 21:48:17 +0100 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@fys.uio.no> | 2005-01-04 21:48:17 +0100 |
commit | 74ce6fec28a0c7862d7832dfdd8e0a73a9d24223 (patch) | |
tree | b66e38ced39d350d9a9ebc7f97b5ff21bda2cb69 /fs | |
parent | c256ae39408bb913e6a722f7d9ccd4c89dfa08e5 (diff) | |
download | history-74ce6fec28a0c7862d7832dfdd8e0a73a9d24223.tar.gz |
NFS: Ensure ACCESS caches are invalidated together with the attribute
cache.
Signed-off-by: Trond Myklebust <trond.myklebust@fys.uio.no>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dir.c | 3 | ||||
-rw-r--r-- | fs/nfs/inode.c | 27 |
2 files changed, 10 insertions, 20 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 3fd8d94e7ddf7a..0e4e9da69f44b6 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1452,7 +1452,7 @@ int nfs_access_get_cached(struct inode *inode, struct rpc_cred *cred, struct nfs if (cache->cred != cred || time_after(jiffies, cache->jiffies + NFS_ATTRTIMEO(inode)) - || (NFS_FLAGS(inode) & NFS_INO_INVALID_ATTR)) + || (NFS_FLAGS(inode) & NFS_INO_INVALID_ACCESS)) return -ENOENT; memcpy(res, cache, sizeof(*res)); return 0; @@ -1466,6 +1466,7 @@ void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set) if (cache->cred) put_rpccred(cache->cred); cache->cred = get_rpccred(set->cred); + NFS_FLAGS(inode) &= ~NFS_INO_INVALID_ACCESS; } cache->jiffies = set->jiffies; cache->mask = set->mask; diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 7399162c0b5c31..400c457e340080 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -565,9 +565,9 @@ nfs_zap_caches(struct inode *inode) memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode))); if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) - nfsi->flags |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; + nfsi->flags |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS; else - nfsi->flags |= NFS_INO_INVALID_ATTR; + nfsi->flags |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS; } /* @@ -766,13 +766,8 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr) vmtruncate(inode, attr->ia_size); } } - if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) { - struct rpc_cred **cred = &NFS_I(inode)->cache_access.cred; - if (*cred) { - put_rpccred(*cred); - *cred = NULL; - } - } + if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) + NFS_FLAGS(inode) |= NFS_INO_INVALID_ACCESS; nfs_end_data_update(inode); unlock_kernel(); return error; @@ -1160,7 +1155,7 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO) || inode->i_uid != fattr->uid || inode->i_gid != fattr->gid) - nfsi->flags |= NFS_INO_INVALID_ATTR; + nfsi->flags |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; /* Has the link count changed? */ if (inode->i_nlink != fattr->nlink) @@ -1269,7 +1264,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign #endif nfsi->change_attr = fattr->change_attr; if (!data_unstable) - invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; + invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS; } memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); @@ -1277,14 +1272,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO) || inode->i_uid != fattr->uid || - inode->i_gid != fattr->gid) { - struct rpc_cred **cred = &NFS_I(inode)->cache_access.cred; - if (*cred) { - put_rpccred(*cred); - *cred = NULL; - } - invalid |= NFS_INO_INVALID_ATTR; - } + inode->i_gid != fattr->gid) + invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS; inode->i_mode = fattr->mode; inode->i_nlink = fattr->nlink; |