fs_context.c (22ed7ecdaefe0cac0c6e6295e83048af60435b13) fs_context.c (d80a8f1b58c2bc8d7c6bfb65401ea4f7ec8cddc2)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* Provide a way to create a superblock configuration context within the kernel
3 * that allows a superblock to be set up prior to mounting.
4 *
5 * Copyright (C) 2017 Red Hat, Inc. All Rights Reserved.
6 * Written by David Howells (dhowells@redhat.com)
7 */
8

--- 301 unchanged lines hidden (view full) ---

310 unsigned int sb_flags,
311 unsigned int sb_flags_mask)
312{
313 return alloc_fs_context(dentry->d_sb->s_type, dentry, sb_flags,
314 sb_flags_mask, FS_CONTEXT_FOR_RECONFIGURE);
315}
316EXPORT_SYMBOL(fs_context_for_reconfigure);
317
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* Provide a way to create a superblock configuration context within the kernel
3 * that allows a superblock to be set up prior to mounting.
4 *
5 * Copyright (C) 2017 Red Hat, Inc. All Rights Reserved.
6 * Written by David Howells (dhowells@redhat.com)
7 */
8

--- 301 unchanged lines hidden (view full) ---

310 unsigned int sb_flags,
311 unsigned int sb_flags_mask)
312{
313 return alloc_fs_context(dentry->d_sb->s_type, dentry, sb_flags,
314 sb_flags_mask, FS_CONTEXT_FOR_RECONFIGURE);
315}
316EXPORT_SYMBOL(fs_context_for_reconfigure);
317
318/**
319 * fs_context_for_submount: allocate a new fs_context for a submount
320 * @type: file_system_type of the new context
321 * @reference: reference dentry from which to copy relevant info
322 *
323 * Allocate a new fs_context suitable for a submount. This also ensures that
324 * the fc->security object is inherited from @reference (if needed).
325 */
318struct fs_context *fs_context_for_submount(struct file_system_type *type,
319 struct dentry *reference)
320{
326struct fs_context *fs_context_for_submount(struct file_system_type *type,
327 struct dentry *reference)
328{
321 return alloc_fs_context(type, reference, 0, 0, FS_CONTEXT_FOR_SUBMOUNT);
329 struct fs_context *fc;
330 int ret;
331
332 fc = alloc_fs_context(type, reference, 0, 0, FS_CONTEXT_FOR_SUBMOUNT);
333 if (IS_ERR(fc))
334 return fc;
335
336 ret = security_fs_context_submount(fc, reference->d_sb);
337 if (ret) {
338 put_fs_context(fc);
339 return ERR_PTR(ret);
340 }
341
342 return fc;
322}
323EXPORT_SYMBOL(fs_context_for_submount);
324
325void fc_drop_locked(struct fs_context *fc)
326{
327 struct super_block *sb = fc->root->d_sb;
328 dput(fc->root);
329 fc->root = NULL;

--- 357 unchanged lines hidden (view full) ---

687 fc->ops->free(fc);
688 fc->need_free = false;
689 fc->fs_private = NULL;
690 fc->s_fs_info = NULL;
691 fc->sb_flags = 0;
692 security_free_mnt_opts(&fc->security);
693 kfree(fc->source);
694 fc->source = NULL;
343}
344EXPORT_SYMBOL(fs_context_for_submount);
345
346void fc_drop_locked(struct fs_context *fc)
347{
348 struct super_block *sb = fc->root->d_sb;
349 dput(fc->root);
350 fc->root = NULL;

--- 357 unchanged lines hidden (view full) ---

708 fc->ops->free(fc);
709 fc->need_free = false;
710 fc->fs_private = NULL;
711 fc->s_fs_info = NULL;
712 fc->sb_flags = 0;
713 security_free_mnt_opts(&fc->security);
714 kfree(fc->source);
715 fc->source = NULL;
695 fc->exclusive = false;
696
697 fc->purpose = FS_CONTEXT_FOR_RECONFIGURE;
698 fc->phase = FS_CONTEXT_AWAITING_RECONF;
699}
700
701int finish_clean_context(struct fs_context *fc)
702{
703 int error;

--- 16 unchanged lines hidden ---
716
717 fc->purpose = FS_CONTEXT_FOR_RECONFIGURE;
718 fc->phase = FS_CONTEXT_AWAITING_RECONF;
719}
720
721int finish_clean_context(struct fs_context *fc)
722{
723 int error;

--- 16 unchanged lines hidden ---