]> git.hungrycats.org Git - linux/commitdiff
[PATCH] missing ->i_zombie in hpux_getdents()
authorAlexander Viro <viro@math.psu.edu>
Wed, 6 Feb 2002 02:53:15 +0000 (18:53 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Wed, 6 Feb 2002 02:53:15 +0000 (18:53 -0800)
hpux_getdents() contains a years-old copy of code from fs/readdir.c.
Switched to use of vfs_readdir(), which does correct locking.

arch/parisc/hpux/fs.c

index 9942c0545265101321fff07ffd3d2b9cef615813..99c06ba7edc1a6de28f168a72ad6f6cab79e243e 100644 (file)
@@ -83,42 +83,20 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, i
 int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int count)
 {
        struct file * file;
-       struct dentry * dentry;
-       struct inode * inode;
        struct hpux_dirent * lastdirent;
        struct getdents_callback buf;
-       int error;
+       int error = -EBADF;
 
-       lock_kernel();
-       error = -EBADF;
        file = fget(fd);
        if (!file)
                goto out;
 
-       dentry = file->f_dentry;
-       if (!dentry)
-               goto out_putf;
-
-       inode = dentry->d_inode;
-       if (!inode)
-               goto out_putf;
-
        buf.current_dir = dirent;
        buf.previous = NULL;
        buf.count = count;
        buf.error = 0;
 
-       error = -ENOTDIR;
-       if (!file->f_op || !file->f_op->readdir)
-               goto out_putf;
-
-       /*
-        * Get the inode's semaphore to prevent changes
-        * to the directory while we read it.
-        */
-       down(&inode->i_sem);
-       error = file->f_op->readdir(file, &buf, filldir);
-       up(&inode->i_sem);
+       error = vfs_readdir(file, &buf, filldir);
        if (error < 0)
                goto out_putf;
        error = buf.error;
@@ -131,7 +109,6 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int coun
 out_putf:
        fput(file);
 out:
-       unlock_kernel();
        return error;
 }