Lines Matching refs:fs
15 void set_fs_root(struct fs_struct *fs, const struct path *path) in set_fs_root() argument
20 spin_lock(&fs->lock); in set_fs_root()
21 write_seqcount_begin(&fs->seq); in set_fs_root()
22 old_root = fs->root; in set_fs_root()
23 fs->root = *path; in set_fs_root()
24 write_seqcount_end(&fs->seq); in set_fs_root()
25 spin_unlock(&fs->lock); in set_fs_root()
34 void set_fs_pwd(struct fs_struct *fs, const struct path *path) in set_fs_pwd() argument
39 spin_lock(&fs->lock); in set_fs_pwd()
40 write_seqcount_begin(&fs->seq); in set_fs_pwd()
41 old_pwd = fs->pwd; in set_fs_pwd()
42 fs->pwd = *path; in set_fs_pwd()
43 write_seqcount_end(&fs->seq); in set_fs_pwd()
44 spin_unlock(&fs->lock); in set_fs_pwd()
62 struct fs_struct *fs; in chroot_fs_refs() local
68 fs = p->fs; in chroot_fs_refs()
69 if (fs) { in chroot_fs_refs()
71 spin_lock(&fs->lock); in chroot_fs_refs()
72 write_seqcount_begin(&fs->seq); in chroot_fs_refs()
73 hits += replace_path(&fs->root, old_root, new_root); in chroot_fs_refs()
74 hits += replace_path(&fs->pwd, old_root, new_root); in chroot_fs_refs()
75 write_seqcount_end(&fs->seq); in chroot_fs_refs()
80 spin_unlock(&fs->lock); in chroot_fs_refs()
89 void free_fs_struct(struct fs_struct *fs) in free_fs_struct() argument
91 path_put(&fs->root); in free_fs_struct()
92 path_put(&fs->pwd); in free_fs_struct()
93 kmem_cache_free(fs_cachep, fs); in free_fs_struct()
99 struct fs_struct *fs = tsk->fs; in exit_fs() local
101 if (fs) { in exit_fs()
104 spin_lock(&fs->lock); in exit_fs()
105 tsk->fs = NULL; in exit_fs()
106 kill = !--fs->users; in exit_fs()
107 spin_unlock(&fs->lock); in exit_fs()
110 free_fs_struct(fs); in exit_fs()
116 struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL); in copy_fs_struct() local
118 if (fs) { in copy_fs_struct()
119 fs->users = 1; in copy_fs_struct()
120 fs->in_exec = 0; in copy_fs_struct()
121 spin_lock_init(&fs->lock); in copy_fs_struct()
122 seqcount_init(&fs->seq); in copy_fs_struct()
123 fs->umask = old->umask; in copy_fs_struct()
126 fs->root = old->root; in copy_fs_struct()
127 path_get(&fs->root); in copy_fs_struct()
128 fs->pwd = old->pwd; in copy_fs_struct()
129 path_get(&fs->pwd); in copy_fs_struct()
132 return fs; in copy_fs_struct()
138 struct fs_struct *fs = current->fs; in unshare_fs_struct() local
139 struct fs_struct *new_fs = copy_fs_struct(fs); in unshare_fs_struct()
146 spin_lock(&fs->lock); in unshare_fs_struct()
147 kill = !--fs->users; in unshare_fs_struct()
148 current->fs = new_fs; in unshare_fs_struct()
149 spin_unlock(&fs->lock); in unshare_fs_struct()
153 free_fs_struct(fs); in unshare_fs_struct()
161 return current->fs->umask; in current_umask()