Re: [RFC v5 PATCH 1/9] xfs: set t_task at wait time instead of alloc time

Allison Collins
2020-02-27T20:49:01Z

On 2/27/20 6:43 AM, Brian Foster wrote:
> The xlog_ticket structure contains a task reference to support
> blocking for available log reservation. This reference is assigned
> at ticket allocation time, which assumes that the transaction
> allocator will acquire reservation in the same context. This is
> normally true, but will not always be the case with automatic
> relogging.
>
> There is otherwise no fundamental reason log space cannot be
> reserved for a ticket from a context different from the allocating
> context. Move the task assignment to the log reservation blocking
> code where it is used.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>

Ok, looks ok to me
Reviewed-by: Allison Collins <allison.henderson@oracle.com>

> ---
> fs/xfs/xfs_log.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index f6006d94a581..df60942a9804 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -262,6 +262,7 @@ xlog_grant_head_wait(
> int need_bytes) __releases(&head->lock)
> __acquires(&head->lock)
> {
> + tic->t_task = current;
> list_add_tail(&tic->t_queue, &head->waiters);
>
> do {
> @@ -3601,7 +3602,6 @@ xlog_ticket_alloc(
> unit_res = xfs_log_calc_unit_res(log->l_mp, unit_bytes);
>
> atomic_set(&tic->t_ref, 1);
> - tic->t_task = current;
> INIT_LIST_HEAD(&tic->t_queue);
> tic->t_unit_res = unit_res;
> tic->t_curr_res = unit_res;
>