Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / afs / dir.c
index d19e7c5..a6dff6a 100644 (file)
@@ -32,7 +32,7 @@ static int afs_d_delete(struct dentry *dentry);
 static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
                                  loff_t fpos, ino_t ino, unsigned dtype);
 
-struct file_operations afs_dir_file_operations = {
+const struct file_operations afs_dir_file_operations = {
        .open           = afs_dir_open,
        .readdir        = afs_dir_readdir,
 };
@@ -65,9 +65,9 @@ union afs_dirent {
        struct {
                uint8_t         valid;
                uint8_t         unused[1];
-               uint16_t        hash_next;
-               uint32_t        vnode;
-               uint32_t        unique;
+               __be16          hash_next;
+               __be32          vnode;
+               __be32          unique;
                uint8_t         name[16];
                uint8_t         overflow[4];    /* if any char of the name (inc
                                                 * NUL) reaches here, consume
@@ -78,8 +78,8 @@ union afs_dirent {
 
 /* AFS directory page header (one at the beginning of every 2048-byte chunk) */
 struct afs_dir_pagehdr {
-       uint16_t        npages;
-       uint16_t        magic;
+       __be16          npages;
+       __be16          magic;
 #define AFS_DIR_MAGIC htons(1234)
        uint8_t         nentries;
        uint8_t         bitmap[8];
@@ -137,7 +137,7 @@ static inline void afs_dir_check_page(struct inode *dir, struct page *page)
 #endif
 
        /* determine how many magic numbers there should be in this page */
-       latter = dir->i_size - (page->index << PAGE_CACHE_SHIFT);
+       latter = dir->i_size - page_offset(page);
        if (latter >= PAGE_SIZE)
                qty = PAGE_SIZE;
        else
@@ -308,7 +308,7 @@ static int afs_dir_iterate_block(unsigned *fpos,
                              blkoff + offset * sizeof(union afs_dirent),
                              ntohl(dire->u.vnode),
                              filldir == afs_dir_lookup_filldir ?
-                             dire->u.unique : DT_UNKNOWN);
+                             ntohl(dire->u.unique) : DT_UNKNOWN);
                if (ret < 0) {
                        _leave(" = 0 [full]");
                        return 0;
@@ -416,7 +416,7 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
        struct afs_dir_lookup_cookie *cookie = _cookie;
 
        _enter("{%s,%Zu},%s,%u,,%lu,%u",
-              cookie->name, cookie->nlen, name, nlen, ino, ntohl(dtype));
+              cookie->name, cookie->nlen, name, nlen, ino, dtype);
 
        if (cookie->nlen != nlen || memcmp(cookie->name, name, nlen) != 0) {
                _leave(" = 0 [no]");
@@ -424,7 +424,7 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
        }
 
        cookie->fid.vnode = ino;
-       cookie->fid.unique = ntohl(dtype);
+       cookie->fid.unique = dtype;
        cookie->found = 1;
 
        _leave(" = -1 [found]");
@@ -615,7 +615,9 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
 
        /* the dirent, if it exists, now points to a different vnode */
  not_found:
+       spin_lock(&dentry->d_lock);
        dentry->d_flags |= DCACHE_NFSFS_RENAMED;
+       spin_unlock(&dentry->d_lock);
 
  out_bad:
        if (inode) {