diff --git a/fs/eventpoll.c b/fs/eventpoll.c index c8fe533466ba..4dc67f71f20f 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1392,15 +1392,23 @@ static int ep_create_wakeup_source(struct epitem *epi) { struct name_snapshot n; struct wakeup_source *ws; + char task_comm_buf[TASK_COMM_LEN]; + char buf[64]; + + get_task_comm(task_comm_buf, current); if (!epi->ep->ws) { - epi->ep->ws = wakeup_source_register(NULL, "eventpoll"); + snprintf(buf, sizeof(buf), "epoll_%.*s_epollfd", + (int)sizeof(task_comm_buf), task_comm_buf); + epi->ep->ws = wakeup_source_register(NULL, buf); if (!epi->ep->ws) return -ENOMEM; } take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry); - ws = wakeup_source_register(NULL, n.name); + snprintf(buf, sizeof(buf), "epoll_%.*s_file:%s", + (int)sizeof(task_comm_buf), task_comm_buf, n.name); + ws = wakeup_source_register(NULL, buf); release_dentry_name_snapshot(&n); if (!ws) diff --git a/fs/timerfd.c b/fs/timerfd.c index 040612ec9598..5d7c3dc24966 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -45,6 +45,8 @@ struct timerfd_ctx { bool might_cancel; }; +static atomic_t instance_count = ATOMIC_INIT(0); + static LIST_HEAD(cancel_list); static DEFINE_SPINLOCK(cancel_lock); @@ -388,6 +390,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) { int ufd; struct timerfd_ctx *ctx; + char task_comm_buf[TASK_COMM_LEN]; + char file_name_buf[32]; + int instance; /* Check the TFD_* constants for consistency. */ BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); @@ -424,7 +429,12 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) ctx->moffs = ktime_mono_to_real(0); - ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, + instance = atomic_inc_return(&instance_count); + get_task_comm(task_comm_buf, current); + snprintf(file_name_buf, sizeof(file_name_buf), "[timerfd%d_%.*s]", + instance, (int)sizeof(task_comm_buf), task_comm_buf); + + ufd = anon_inode_getfd(file_name_buf, &timerfd_fops, ctx, O_RDWR | (flags & TFD_SHARED_FCNTL_FLAGS)); if (ufd < 0) kfree(ctx);