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()
61 struct fs_struct *fs; in chroot_fs_refs() local
67 fs = p->fs; in chroot_fs_refs()
68 if (fs) { in chroot_fs_refs()
70 spin_lock(&fs->lock); in chroot_fs_refs()
71 write_seqcount_begin(&fs->seq); in chroot_fs_refs()
72 hits += replace_path(&fs->root, old_root, new_root); in chroot_fs_refs()
73 hits += replace_path(&fs->pwd, old_root, new_root); in chroot_fs_refs()
74 write_seqcount_end(&fs->seq); in chroot_fs_refs()
79 spin_unlock(&fs->lock); in chroot_fs_refs()
88 void free_fs_struct(struct fs_struct *fs) in free_fs_struct() argument
90 path_put(&fs->root); in free_fs_struct()
91 path_put(&fs->pwd); in free_fs_struct()
92 kmem_cache_free(fs_cachep, fs); in free_fs_struct()
97 struct fs_struct *fs = tsk->fs; in exit_fs() local
99 if (fs) { in exit_fs()
102 spin_lock(&fs->lock); in exit_fs()
103 tsk->fs = NULL; in exit_fs()
104 kill = !--fs->users; in exit_fs()
105 spin_unlock(&fs->lock); in exit_fs()
108 free_fs_struct(fs); in exit_fs()
114 struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL); in copy_fs_struct() local
116 if (fs) { in copy_fs_struct()
117 fs->users = 1; in copy_fs_struct()
118 fs->in_exec = 0; in copy_fs_struct()
119 spin_lock_init(&fs->lock); in copy_fs_struct()
120 seqcount_spinlock_init(&fs->seq, &fs->lock); in copy_fs_struct()
121 fs->umask = old->umask; in copy_fs_struct()
124 fs->root = old->root; in copy_fs_struct()
125 path_get(&fs->root); in copy_fs_struct()
126 fs->pwd = old->pwd; in copy_fs_struct()
127 path_get(&fs->pwd); in copy_fs_struct()
130 return fs; in copy_fs_struct()
135 struct fs_struct *fs = current->fs; in unshare_fs_struct() local
136 struct fs_struct *new_fs = copy_fs_struct(fs); in unshare_fs_struct()
143 spin_lock(&fs->lock); in unshare_fs_struct()
144 kill = !--fs->users; in unshare_fs_struct()
145 current->fs = new_fs; in unshare_fs_struct()
146 spin_unlock(&fs->lock); in unshare_fs_struct()
150 free_fs_struct(fs); in unshare_fs_struct()
158 return current->fs->umask; in current_umask()