change close_files() to use rcu_dereference_raw(files->fdt)
authorOleg Nesterov <oleg@redhat.com>
Sat, 11 Jan 2014 18:19:53 +0000 (19:19 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 25 Jan 2014 08:14:37 +0000 (03:14 -0500)
commitce08b62d18b3f97cd4e5a39bd5898872b9201875
treec5fc6f39a15131e28954cdb7fea7f8e181bc5eee
parenta8d4b8345e0ee48b732126d980efaf0dc373e2b0
change close_files() to use rcu_dereference_raw(files->fdt)

put_files_struct() and close_files() do rcu_read_lock() to make
rcu_dereference_check_fdtable() happy.

This looks a bit ugly, files_fdtable() just reads the pointer,
we can simply use rcu_dereference_raw() to avoid the warning.

The patch also changes close_files() to return fdt, this avoids
another rcu_read_lock()/files_fdtable() in put_files_struct().

I think close_files() needs more cleanups:

- we do not need xchg() exactly because we are the last
  user of this files_struct

- "if (file)" should be turned into WARN_ON(!file)

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/file.c