OSDN Git Service

f2fs: Add a small clarification to CONFIG_FS_F2FS_FS_SECURITY
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / fs / timerfd.c
index 1327a02..0274ae2 100644 (file)
@@ -44,6 +44,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);
 
@@ -387,6 +389,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);
@@ -418,7 +423,12 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
 
        ctx->moffs = ktime_mono_to_real((ktime_t){ .tv64 = 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);