Re: [PATCH v8 04/18] liveupdate: luo_session: add sessions support
From: Jason Gunthorpe
Date: Wed Jan 07 2026 - 13:20:59 EST
On Tue, Nov 25, 2025 at 11:58:34AM -0500, Pasha Tatashin wrote:
> +/* Create a "struct file" for session */
> +static int luo_session_getfile(struct luo_session *session, struct file **filep)
> +{
> + char name_buf[128];
> + struct file *file;
> +
> + lockdep_assert_held(&session->mutex);
> + snprintf(name_buf, sizeof(name_buf), "[luo_session] %s", session->name);
> + file = anon_inode_getfile(name_buf, &luo_session_fops, session, O_RDWR);
> + if (IS_ERR(file))
> + return PTR_ERR(file);
> +
> + *filep = file;
> +
> + return 0;
> +}
This is a bit odd, I'd expect it to return the file * not int ?
> +int luo_session_create(const char *name, struct file **filep)
> +{
Here too
> + struct luo_session *session;
> + int err;
> +
> + session = luo_session_alloc(name);
> + if (IS_ERR(session))
> + return PTR_ERR(session);
> +
> + err = luo_session_insert(&luo_session_global.outgoing, session);
> + if (err)
> + goto err_free;
> +
> + scoped_guard(mutex, &session->mutex)
> + err = luo_session_getfile(session, filep);
Is it style guide to have {} around scoped_guard's body?
> +int luo_session_retrieve(const char *name, struct file **filep)
> +{
Also here
Jason