Commit 7b4b5a08 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] missing ->i_zombie in hpux_getdents()

	hpux_getdents() contains a years-old copy of code from fs/readdir.c.
Switched to use of vfs_readdir(), which does correct locking.
parent 9a468439
...@@ -83,42 +83,20 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, i ...@@ -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) int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int count)
{ {
struct file * file; struct file * file;
struct dentry * dentry;
struct inode * inode;
struct hpux_dirent * lastdirent; struct hpux_dirent * lastdirent;
struct getdents_callback buf; struct getdents_callback buf;
int error; int error = -EBADF;
lock_kernel();
error = -EBADF;
file = fget(fd); file = fget(fd);
if (!file) if (!file)
goto out; 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.current_dir = dirent;
buf.previous = NULL; buf.previous = NULL;
buf.count = count; buf.count = count;
buf.error = 0; buf.error = 0;
error = -ENOTDIR; error = vfs_readdir(file, &buf, filldir);
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);
if (error < 0) if (error < 0)
goto out_putf; goto out_putf;
error = buf.error; error = buf.error;
...@@ -131,7 +109,6 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int coun ...@@ -131,7 +109,6 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int coun
out_putf: out_putf:
fput(file); fput(file);
out: out:
unlock_kernel();
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment