Re: [PATCH v2 02/24] fs/locks: print full locks information

From: J. Bruce Fields
Date: Wed Feb 24 2021 - 10:31:11 EST


On Wed, Feb 24, 2021 at 03:35:44AM -0500, Luo Longjun wrote:
> @@ -2912,17 +2922,66 @@ static int locks_show(struct seq_file *f, void *v)
> struct file_lock *fl, *bfl;
> struct pid_namespace *proc_pidns = proc_pid_ns(file_inode(f->file)->i_sb);
>
> + struct list_head root;
> + struct list_head *tail = &root;
> + struct list_head *pos, *tmp;
> + struct locks_traverse_list *node, *node_child;
> +
> + int ret = 0;
> +
> fl = hlist_entry(v, struct file_lock, fl_link);
>
> if (locks_translate_pid(fl, proc_pidns) == 0)
> - return 0;
> + return ret;
> +
> + INIT_LIST_HEAD(&root);
>
> - lock_get_status(f, fl, iter->li_pos, "");
> + node = kmalloc(sizeof(struct locks_traverse_list), GFP_KERNEL);

Is it safe to allocate here? I thought this was under the
blocked_lock_lock spinlock.

And I still don't think you need a stack. Have you tried the suggestion
in my previous mail?

--b.