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()
60 struct fs_struct *fs; in chroot_fs_refs() local
66 fs = p->fs; in chroot_fs_refs()
67 if (fs) { in chroot_fs_refs()
69 spin_lock(&fs->lock); in chroot_fs_refs()
70 write_seqcount_begin(&fs->seq); in chroot_fs_refs()
71 hits += replace_path(&fs->root, old_root, new_root); in chroot_fs_refs()
72 hits += replace_path(&fs->pwd, old_root, new_root); in chroot_fs_refs()
73 write_seqcount_end(&fs->seq); in chroot_fs_refs()
78 spin_unlock(&fs->lock); in chroot_fs_refs()
87 void free_fs_struct(struct fs_struct *fs) in free_fs_struct() argument
89 path_put(&fs->root); in free_fs_struct()
90 path_put(&fs->pwd); in free_fs_struct()
91 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_init(&fs->seq); 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()
136 struct fs_struct *fs = current->fs; in unshare_fs_struct() local
137 struct fs_struct *new_fs = copy_fs_struct(fs); in unshare_fs_struct()
144 spin_lock(&fs->lock); in unshare_fs_struct()
145 kill = !--fs->users; in unshare_fs_struct()
146 current->fs = new_fs; in unshare_fs_struct()
147 spin_unlock(&fs->lock); in unshare_fs_struct()
151 free_fs_struct(fs); in unshare_fs_struct()
159 return current->fs->umask; in current_umask()