aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-19 12:04:24 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 21:08:56 -0400
commit483ce1d4b8c3b82bc9c9a1dd9dbc44f50b3aaf5a (patch)
tree46a43df814fc7f7bb0c22d0c47fabb7db95d7ada /fs/open.c
parent0ee8cdfe6af052deb56dccd54838a1eb32fb4ca2 (diff)
take descriptor-related part of close() to file.c
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/fs/open.c b/fs/open.c
index c525bd0e65b6..30760017deed 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -994,23 +994,7 @@ EXPORT_SYMBOL(filp_close);
994 */ 994 */
995SYSCALL_DEFINE1(close, unsigned int, fd) 995SYSCALL_DEFINE1(close, unsigned int, fd)
996{ 996{
997 struct file * filp; 997 int retval = __close_fd(current->files, fd);
998 struct files_struct *files = current->files;
999 struct fdtable *fdt;
1000 int retval;
1001
1002 spin_lock(&files->file_lock);
1003 fdt = files_fdtable(files);
1004 if (fd >= fdt->max_fds)
1005 goto out_unlock;
1006 filp = fdt->fd[fd];
1007 if (!filp)
1008 goto out_unlock;
1009 rcu_assign_pointer(fdt->fd[fd], NULL);
1010 __clear_close_on_exec(fd, fdt);
1011 __put_unused_fd(files, fd);
1012 spin_unlock(&files->file_lock);
1013 retval = filp_close(filp, files);
1014 998
1015 /* can't restart close syscall because file table entry was cleared */ 999 /* can't restart close syscall because file table entry was cleared */
1016 if (unlikely(retval == -ERESTARTSYS || 1000 if (unlikely(retval == -ERESTARTSYS ||
@@ -1020,10 +1004,6 @@ SYSCALL_DEFINE1(close, unsigned int, fd)
1020 retval = -EINTR; 1004 retval = -EINTR;
1021 1005
1022 return retval; 1006 return retval;
1023
1024out_unlock:
1025 spin_unlock(&files->file_lock);
1026 return -EBADF;
1027} 1007}
1028EXPORT_SYMBOL(sys_close); 1008EXPORT_SYMBOL(sys_close);
1029 1009