vserver 1.9.3
[linux-2.6.git] / fs / exportfs / expfs.c
index edde9a5..0a6f7b0 100644 (file)
@@ -1,5 +1,6 @@
 
 #include <linux/fs.h>
+#include <linux/file.h>
 #include <linux/module.h>
 #include <linux/smp_lock.h>
 #include <linux/namei.h>
@@ -282,7 +283,12 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
 
        /* drat - I just cannot find anything acceptable */
        dput(result);
-       return ERR_PTR(-ESTALE);
+       /* It might be justifiable to return ESTALE here,
+        * but the filehandle at-least looks reasonable good
+        * and it just be a permission problem, so returning
+        * -EACCESS is safer
+        */
+       return ERR_PTR(-EACCES);
 
  err_target:
        dput(target_dir);
@@ -347,7 +353,7 @@ static int get_name(struct dentry *dentry, char *name,
 {
        struct inode *dir = dentry->d_inode;
        int error;
-       struct file file;
+       struct file *file;
        struct getdents_callback buffer;
 
        error = -ENOTDIR;
@@ -359,11 +365,13 @@ static int get_name(struct dentry *dentry, char *name,
        /*
         * Open the directory ...
         */
-       error = open_private_file(&file, dentry, O_RDONLY);
-       if (error)
+       file = dentry_open(dget(dentry), NULL, O_RDONLY);
+       error = PTR_ERR(file);
+       if (IS_ERR(file))
                goto out;
+
        error = -EINVAL;
-       if (!file.f_op->readdir)
+       if (!file->f_op->readdir)
                goto out_close;
 
        buffer.name = name;
@@ -373,7 +381,7 @@ static int get_name(struct dentry *dentry, char *name,
        while (1) {
                int old_seq = buffer.sequence;
 
-               error = vfs_readdir(&file, filldir_one, &buffer);
+               error = vfs_readdir(file, filldir_one, &buffer);
 
                if (error < 0)
                        break;
@@ -387,7 +395,7 @@ static int get_name(struct dentry *dentry, char *name,
        }
 
 out_close:
-       close_private_file(&file);
+       fput(file);
 out:
        return error;
 }