summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-22 18:42:10 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 21:10:00 -0400
commit864bdb3b6cbd9911222543fef1cfe36f88183f44 (patch)
treebd00e6293592a084ee0fe68e3acb93060f54ae68 /fs
parent2be7fd55d44882c9818ed2d1dabc0f0abab5eeed (diff)
new helper: daemonize_descriptors()
descriptor-related parts of daemonize, done right. As the result we simplify the locking rules for ->files - we hold task_lock in *all* cases when we modify ->files. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/file.c b/fs/file.c
index e6e418122587..15750b80e3ce 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -519,6 +519,12 @@ struct files_struct init_files = {
.file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock),
};
+void daemonize_descriptors(void)
+{
+ atomic_inc(&init_files.count);
+ reset_files_struct(&init_files);
+}
+
/*
* allocate a file descriptor, mark it busy.
*/