fs/ocfs2/namei.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/namei.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/namei.c- Extension
.c- Size
- 71595 bytes
- Lines
- 2946
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/types.hlinux/slab.hlinux/string.hlinux/highmem.hlinux/quotaops.hlinux/iversion.hcluster/masklog.hocfs2.halloc.hdcache.hdir.hdlmglue.hextent_map.hfile.hinode.hjournal.hnamei.hsuballoc.hsuper.hsymlink.hsysfile.huptodate.hxattr.hacl.hocfs2_trace.hioctl.hbuffer_head_io.h
Detected Declarations
function ocfs2_cleanup_add_entry_failurefunction ocfs2_mknodfunction __ocfs2_mknod_lockedfunction ocfs2_mknod_lockedfunction ocfs2_createfunction ocfs2_linkfunction ocfs2_remote_dentry_deletefunction ocfs2_inode_is_unlinkablefunction ocfs2_unlinkfunction ocfs2_check_if_ancestorfunction ocfs2_double_lockfunction ocfs2_double_unlockfunction ocfs2_renamefunction ocfs2_create_symlink_datafunction ocfs2_clusters_to_bytesfunction ocfs2_symlinkfunction ocfs2_blkno_stringifyfunction ocfs2_lookup_lock_orphan_dirfunction __ocfs2_prepare_orphan_dirfunction ocfs2_prepare_orphan_dirfunction ocfs2_orphan_addfunction ocfs2_orphan_delfunction ocfs2_prep_new_orphaned_filefunction ocfs2_create_inode_in_orphanfunction ocfs2_add_inode_to_orphanfunction ocfs2_del_inode_from_orphanfunction ocfs2_mv_orphaned_inode_to_new
Annotated Snippet
if (status) {
mlog_errno(status);
if (ret)
dput(ret);
ret = ERR_PTR(status);
}
} else
ocfs2_dentry_attach_gen(dentry);
bail_unlock:
/* Don't drop the cluster lock until *after* the d_add --
* unlink on another node will message us to remove that
* dentry under this lock so otherwise we can race this with
* the downconvert thread and have a stale dentry. */
ocfs2_inode_unlock(dir, 0);
bail:
trace_ocfs2_lookup_ret(ret);
return ret;
}
static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode)
{
struct inode *inode;
int status;
inode = new_inode(dir->i_sb);
if (!inode) {
mlog(ML_ERROR, "new_inode failed!\n");
return ERR_PTR(-ENOMEM);
}
/* populate as many fields early on as possible - many of
* these are used by the support functions here and in
* callers. */
if (S_ISDIR(mode))
set_nlink(inode, 2);
mode = mode_strip_sgid(&nop_mnt_idmap, dir, mode);
inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
status = dquot_initialize(inode);
if (status) {
iput(inode);
return ERR_PTR(status);
}
return inode;
}
static void ocfs2_cleanup_add_entry_failure(struct ocfs2_super *osb,
struct dentry *dentry, struct inode *inode)
{
struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
ocfs2_simple_drop_lockres(osb, &dl->dl_lockres);
ocfs2_lock_res_free(&dl->dl_lockres);
BUG_ON(dl->dl_count != 1);
spin_lock(&dentry_attach_lock);
dentry->d_fsdata = NULL;
spin_unlock(&dentry_attach_lock);
kfree(dl);
iput(inode);
}
static int ocfs2_mknod(struct mnt_idmap *idmap,
struct inode *dir,
struct dentry *dentry,
umode_t mode,
dev_t dev)
{
int status = 0;
struct buffer_head *parent_fe_bh = NULL;
handle_t *handle = NULL;
struct ocfs2_super *osb;
struct ocfs2_dinode *dirfe;
struct ocfs2_dinode *fe = NULL;
struct buffer_head *new_fe_bh = NULL;
struct inode *inode = NULL;
struct ocfs2_alloc_context *inode_ac = NULL;
struct ocfs2_alloc_context *data_ac = NULL;
struct ocfs2_alloc_context *meta_ac = NULL;
int want_clusters = 0;
int want_meta = 0;
int xattr_credits = 0;
struct ocfs2_security_xattr_info si = {
.name = NULL,
.enable = 1,
};
int did_quota_inode = 0;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/types.h`, `linux/slab.h`, `linux/string.h`, `linux/highmem.h`, `linux/quotaops.h`, `linux/iversion.h`, `cluster/masklog.h`.
- Detected declarations: `function ocfs2_cleanup_add_entry_failure`, `function ocfs2_mknod`, `function __ocfs2_mknod_locked`, `function ocfs2_mknod_locked`, `function ocfs2_create`, `function ocfs2_link`, `function ocfs2_remote_dentry_delete`, `function ocfs2_inode_is_unlinkable`, `function ocfs2_unlink`, `function ocfs2_check_if_ancestor`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.