On Thu, 8 Sep 2016, Fenghua Yu wrote: > +static struct kernfs_syscall_ops rdtgroup_kf_syscall_ops = { > + .mkdir = rdtgroup_mkdir, > + .rmdir = rdtgroup_rmdir, > +}; > + > +static struct file_system_type rdt_fs_type = { > + .name = "resctrl", > + .mount = rdt_mount, > + .kill_sb = rdt_kill_sb, > +};
So the above struct is nicely aligned and readable. While this one is not. Sigh, > struct rdtgroup *root_rdtgrp; > static struct rftype rdtgroup_partition_base_files[]; > struct cache_domain cache_domains[MAX_CACHE_LEAVES]; > /* The default hierarchy. */ > struct rdtgroup_root rdtgrp_dfl_root; > static struct list_head rdtgroups; > +bool rdtgroup_mounted; Your choice of global/static visible variables is driven by a random generator or what? > /* > * kernfs_root - find out the kernfs_root a kernfs_node belongs to > @@ -730,6 +749,110 @@ static void rdtgroup_destroy_locked(struct rdtgroup > *rdtgrp) > kernfs_remove(rdtgrp->kn); > } > > +static int rdtgroup_mkdir(struct kernfs_node *parent_kn, const char *name, > + umode_t mode) > +{ > + struct rdtgroup *parent, *rdtgrp; > + struct rdtgroup_root *root; > + struct kernfs_node *kn; > + int ret; > + > + if (parent_kn != root_rdtgrp->kn) > + return -EPERM; > + > + /* Do not accept '\n' to avoid unparsable situation. > + */ Where did copy you this comment style from? Its' horrible and here is a lengthy explanation why: https://lkml.org/lkml/2016/7/8/625 > +static struct dentry *rdt_mount(struct file_system_type *fs_type, > + int flags, const char *unused_dev_name, > + void *data) > +{ > + struct super_block *pinned_sb = NULL; > + struct rdtgroup_root *root; > + struct dentry *dentry; > + int ret; > + bool new_sb; > + > + /* > + * The first time anyone tries to mount a rdtgroup, enable the list > + * linking tasks and fix up all existing tasks. What are 'list linking tasks'? What is fixed up here? > + */ > + if (rdtgroup_mounted) > + return ERR_PTR(-EBUSY); How is this serialized against concurrent mounts? Oh well.... > + rdt_opts.cdp_enabled = false; > + rdt_opts.verbose = false; > + cdp_enabled = false; > + > + ret = parse_rdtgroupfs_options(data); > + if (ret) > + goto out_mount; > + > + if (rdt_opts.cdp_enabled) { > + cdp_enabled = true; > + cconfig.max_closid >>= cdp_enabled; > + pr_info("CDP is enabled\n"); > + } > + > + init_msrs(cdp_enabled); > + > + root = &rdtgrp_dfl_root; > + > + ret = get_default_resources(&root->rdtgrp); > + if (ret) > + return ERR_PTR(-ENOSPC); > + > +out_mount: > + dentry = kernfs_mount(fs_type, flags, root->kf_root, > + RDTGROUP_SUPER_MAGIC, > + &new_sb); > + if (IS_ERR(dentry) || !new_sb) > + goto out_unlock; And ret , which is returned @out_unlock is 0. So instead of returning the error code encoded in dentry you return a NULL pointer. > + /* > + * If @pinned_sb, we're reusing an existing root and holding an > + * extra ref on its sb. Mount is complete. Put the extra ref. > + */ > + if (pinned_sb) { And how exactly becomes pinned_sb != NULL? > + WARN_ON(new_sb); > + deactivate_super(pinned_sb); > + } Not at all. > + INIT_LIST_HEAD(&root->rdtgrp.pset.tasks); > + > + cpumask_copy(&root->rdtgrp.cpu_mask, cpu_online_mask); > + static_key_slow_inc(&rdt_enable_key); > + rdtgroup_mounted = true; > + > + return dentry; > + > +out_unlock: > + return ERR_PTR(ret); So a return magically unlocks stuff. Or does this happen in ERR_PTR()? This jump label is not only pointless it's also named badly. Thanks, tglx