Lines Matching refs:fs

13 void set_fs_root(struct fs_struct *fs, const struct path *path)  in set_fs_root()  argument
18 spin_lock(&fs->lock); in set_fs_root()
19 write_seqcount_begin(&fs->seq); in set_fs_root()
20 old_root = fs->root; in set_fs_root()
21 fs->root = *path; in set_fs_root()
22 write_seqcount_end(&fs->seq); in set_fs_root()
23 spin_unlock(&fs->lock); in set_fs_root()
32 void set_fs_pwd(struct fs_struct *fs, const struct path *path) in set_fs_pwd() argument
37 spin_lock(&fs->lock); in set_fs_pwd()
38 write_seqcount_begin(&fs->seq); in set_fs_pwd()
39 old_pwd = fs->pwd; in set_fs_pwd()
40 fs->pwd = *path; in set_fs_pwd()
41 write_seqcount_end(&fs->seq); in set_fs_pwd()
42 spin_unlock(&fs->lock); in set_fs_pwd()
59 struct fs_struct *fs; in chroot_fs_refs() local
65 fs = p->fs; in chroot_fs_refs()
66 if (fs) { in chroot_fs_refs()
68 spin_lock(&fs->lock); in chroot_fs_refs()
69 write_seqcount_begin(&fs->seq); in chroot_fs_refs()
70 hits += replace_path(&fs->root, old_root, new_root); in chroot_fs_refs()
71 hits += replace_path(&fs->pwd, old_root, new_root); in chroot_fs_refs()
72 write_seqcount_end(&fs->seq); in chroot_fs_refs()
77 spin_unlock(&fs->lock); in chroot_fs_refs()
86 void free_fs_struct(struct fs_struct *fs) in free_fs_struct() argument
88 path_put(&fs->root); in free_fs_struct()
89 path_put(&fs->pwd); in free_fs_struct()
90 kmem_cache_free(fs_cachep, fs); in free_fs_struct()
95 struct fs_struct *fs = tsk->fs; in exit_fs() local
97 if (fs) { in exit_fs()
100 spin_lock(&fs->lock); in exit_fs()
101 tsk->fs = NULL; in exit_fs()
102 kill = !--fs->users; in exit_fs()
103 spin_unlock(&fs->lock); in exit_fs()
106 free_fs_struct(fs); in exit_fs()
112 struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL); in copy_fs_struct() local
114 if (fs) { in copy_fs_struct()
115 fs->users = 1; in copy_fs_struct()
116 fs->in_exec = 0; in copy_fs_struct()
117 spin_lock_init(&fs->lock); in copy_fs_struct()
118 seqcount_init(&fs->seq); in copy_fs_struct()
119 fs->umask = old->umask; in copy_fs_struct()
122 fs->root = old->root; in copy_fs_struct()
123 path_get(&fs->root); in copy_fs_struct()
124 fs->pwd = old->pwd; in copy_fs_struct()
125 path_get(&fs->pwd); in copy_fs_struct()
128 return fs; in copy_fs_struct()
133 struct fs_struct *fs = current->fs; in unshare_fs_struct() local
134 struct fs_struct *new_fs = copy_fs_struct(fs); in unshare_fs_struct()
141 spin_lock(&fs->lock); in unshare_fs_struct()
142 kill = !--fs->users; in unshare_fs_struct()
143 current->fs = new_fs; in unshare_fs_struct()
144 spin_unlock(&fs->lock); in unshare_fs_struct()
148 free_fs_struct(fs); in unshare_fs_struct()
156 return current->fs->umask; in current_umask()