]> git.hungrycats.org Git - linux/commitdiff
[PATCH] JFS fix for NFS on little-endian systems
authorAndrew Morton <akpm@osdl.org>
Tue, 6 Jan 2004 23:52:30 +0000 (15:52 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 6 Jan 2004 23:52:30 +0000 (15:52 -0800)
From: Dave Kleikamp <shaggy@austin.ibm.com>

After Jose debugged the problem down to the routine jfs_get_parent, we
were able to find the problem.  I believe it only affects users of
NFS-exported JFS file systems on big-endian hardware.

The problem was a missing le32_to_cpu macro.  The patch also fixes a
return code to be more consistent other implementations of get_parent.

fs/jfs/namei.c

index f71cd7088d63125d590414ba193fe9bd10f48f4c..fae7ce9f3337756961599c40770f74cf3fe70268 100644 (file)
@@ -1439,14 +1439,18 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
 struct dentry *jfs_get_parent(struct dentry *dentry)
 {
        struct super_block *sb = dentry->d_inode->i_sb;
-       struct dentry *parent = ERR_PTR(-EACCES);
+       struct dentry *parent = ERR_PTR(-ENOENT);
        struct inode *inode;
+       unsigned long parent_ino;
 
-       inode = iget(sb, JFS_IP(dentry->d_inode)->i_dtroot.header.idotdot);
+       parent_ino =
+               le32_to_cpu(JFS_IP(dentry->d_inode)->i_dtroot.header.idotdot);
+       inode = iget(sb, parent_ino);
        if (inode) {
-               if (is_bad_inode(inode))
+               if (is_bad_inode(inode)) {
                        iput(inode);
-               else {
+                       parent = ERR_PTR(-EACCES);
+               } else {
                        parent = d_alloc_anon(inode);
                        if (!parent) {
                                parent = ERR_PTR(-ENOMEM);