Merge branch 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
[pandora-kernel.git] / fs / nfs / dir.c
index 5732e13..2df639f 100644 (file)
@@ -182,14 +182,16 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
                /* We requested READDIRPLUS, but the server doesn't grok it */
                if (error == -ENOTSUPP && desc->plus) {
                        NFS_SERVER(inode)->caps &= ~NFS_CAP_READDIRPLUS;
-                       NFS_FLAGS(inode) &= ~NFS_INO_ADVISE_RDPLUS;
+                       clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode));
                        desc->plus = 0;
                        goto again;
                }
                goto error;
        }
        SetPageUptodate(page);
+       spin_lock(&inode->i_lock);
        NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME;
+       spin_unlock(&inode->i_lock);
        /* Ensure consistent page alignment of the data.
         * Note: assumes we have exclusive access to this mapping either
         *       through inode->i_sem or some other mechanism.
@@ -462,7 +464,9 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
                                                page,
                                                NFS_SERVER(inode)->dtsize,
                                                desc->plus);
+       spin_lock(&inode->i_lock);
        NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME;
+       spin_unlock(&inode->i_lock);
        desc->page = page;
        desc->ptr = kmap(page);         /* matching kunmap in nfs_do_filldir */
        if (desc->error >= 0) {
@@ -545,7 +549,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
                        break;
                }
                if (res == -ETOOSMALL && desc->plus) {
-                       NFS_FLAGS(inode) &= ~NFS_INO_ADVISE_RDPLUS;
+                       clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode));
                        nfs_zap_caches(inode);
                        desc->plus = 0;
                        desc->entry->eof = 0;
@@ -935,6 +939,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
        error = nfs_revalidate_inode(NFS_SERVER(dir), dir);
        if (error < 0) {
                res = ERR_PTR(error);
+               unlock_kernel();
                goto out;
        }
 
@@ -1596,7 +1601,10 @@ void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set)
                        put_rpccred(cache->cred);
                cache->cred = get_rpccred(set->cred);
        }
+       /* FIXME: replace current access_cache BKL reliance with inode->i_lock */
+       spin_lock(&inode->i_lock);
        nfsi->cache_validity &= ~NFS_INO_INVALID_ACCESS;
+       spin_unlock(&inode->i_lock);
        cache->jiffies = set->jiffies;
        cache->mask = set->mask;
 }