summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-06-08 12:12:11 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-06-08 12:12:11 -0700
commit8d72e5bd86cb405d8d8b9e92905d8cfffd08dde8 (patch)
tree65d5e73b08d7a573784dca677e374fd6fc25a694 /kernel
parent1b02caa319cf73ae89aced8714066a3a5bbe648b (diff)
parent6c70f899b8089ae23cdb4aa63050e3df4e20c71e (diff)
downloadlinux-8d72e5bd86cb405d8d8b9e92905d8cfffd08dde8.tar.bz2
Merge tag 'for-linus-20190608' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - Allow symlink from the bfq.weight cgroup parameter to the general weight (Angelo) - Damien is new skd maintainer (Bart) - NVMe pull request from Sagi, with a few small fixes. - Ensure we set DMA segment size properly, dma-debug is now tripping on these (Christoph) - Remove useless debugfs_create() return check (Greg) - Remove redundant unlikely() check on IS_ERR() (Kefeng) - Fixup request freeing on exit (Ming) * tag 'for-linus-20190608' of git://git.kernel.dk/linux-block: block, bfq: add weight symlink to the bfq.weight cgroup parameter cgroup: let a symlink too be created with a cftype file block: free sched's request pool in blk_cleanup_queue nvme-rdma: use dynamic dma mapping per command nvme: Fix u32 overflow in the number of namespace list calculation mmc: also set max_segment_size in the device mtip32xx: also set max_segment_size in the device rsxx: don't call dma_set_max_seg_size nvme-pci: don't limit DMA segement size block: Drop unlikely before IS_ERR(_OR_NULL) block: aoe: no need to check return value of debugfs_create functions nvmet: fix data_len to 0 for bdev-backed write_zeroes MAINTAINERS: Hand over skd maintainership nvme-tcp: fix queue mapping when queue count is limited nvme-rdma: fix queue mapping when queue count is limited
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup/cgroup.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 426a0026225c..155048b0eca2 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1460,8 +1460,8 @@ struct cgroup *task_cgroup_from_root(struct task_struct *task,
static struct kernfs_syscall_ops cgroup_kf_syscall_ops;
-static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
- char *buf)
+static char *cgroup_fill_name(struct cgroup *cgrp, const struct cftype *cft,
+ char *buf, bool write_link_name)
{
struct cgroup_subsys *ss = cft->ss;
@@ -1471,13 +1471,26 @@ static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
snprintf(buf, CGROUP_FILE_NAME_MAX, "%s%s.%s",
dbg, cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
- cft->name);
+ write_link_name ? cft->link_name : cft->name);
} else {
- strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
+ strscpy(buf, write_link_name ? cft->link_name : cft->name,
+ CGROUP_FILE_NAME_MAX);
}
return buf;
}
+static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
+ char *buf)
+{
+ return cgroup_fill_name(cgrp, cft, buf, false);
+}
+
+static char *cgroup_link_name(struct cgroup *cgrp, const struct cftype *cft,
+ char *buf)
+{
+ return cgroup_fill_name(cgrp, cft, buf, true);
+}
+
/**
* cgroup_file_mode - deduce file mode of a control file
* @cft: the control file in question
@@ -1636,6 +1649,9 @@ static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft)
}
kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name));
+ if (cft->flags & CFTYPE_SYMLINKED)
+ kernfs_remove_by_name(cgrp->kn,
+ cgroup_link_name(cgrp, cft, name));
}
/**
@@ -3821,6 +3837,7 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp,
{
char name[CGROUP_FILE_NAME_MAX];
struct kernfs_node *kn;
+ struct kernfs_node *kn_link;
struct lock_class_key *key = NULL;
int ret;
@@ -3851,6 +3868,14 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp,
spin_unlock_irq(&cgroup_file_kn_lock);
}
+ if (cft->flags & CFTYPE_SYMLINKED) {
+ kn_link = kernfs_create_link(cgrp->kn,
+ cgroup_link_name(cgrp, cft, name),
+ kn);
+ if (IS_ERR(kn_link))
+ return PTR_ERR(kn_link);
+ }
+
return 0;
}