Re: [PATCH 05/12] xfs: clean up log ticket overrun debug output

Dave Chinner
2010-05-19T22:39:00Z

On Wed, May 19, 2010 at 02:16:44PM -0500, Alex Elder wrote:
> On Tue, 2010-05-18 at 09:24 +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > Push the error message output when a ticket overrun is detected
> > into the ticket printing functions. Also remove the debug version
> > of the code as the production version will still panic just as
> > effectively on a debug kernel via the panic mask being set.
>
> Another not-really-actionable bit of commentary
> below, but this looks good.
>
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
> > ---
> > fs/xfs/xfs_error.c | 2 +-
> > fs/xfs/xfs_log.c | 19 +++++--------------
> > 2 files changed, 6 insertions(+), 15 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
> > index ef96175..047b8a8 100644
> > --- a/fs/xfs/xfs_error.c
> > +++ b/fs/xfs/xfs_error.c
> > @@ -170,7 +170,7 @@ xfs_cmn_err(int panic_tag, int level, xfs_mount_t *mp, char *fmt, ...)
> > va_list ap;
> >
> > #ifdef DEBUG
> > - xfs_panic_mask |= XFS_PTAG_SHUTDOWN_CORRUPT;
> > + xfs_panic_mask |= (XFS_PTAG_SHUTDOWN_CORRUPT | XFS_PTAG_LOGRES);
> > #endif
> >
> > if (xfs_panic_mask && (xfs_panic_mask & panic_tag)
> > diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> > index 83be6a6..1efb303 100644
> > --- a/fs/xfs/xfs_log.c
> > +++ b/fs/xfs/xfs_log.c
> > @@ -1645,6 +1645,10 @@ xlog_print_tic_res(xfs_mount_t *mp, xlog_ticket_t *ticket)
> > "bad-rtype" : res_type_str[r_type-1]),
> > ticket->t_res_arr[i].r_len);
> > }
> > +
> > + xfs_cmn_err(XFS_PTAG_LOGRES, CE_ALERT, mp,
> > + "xfs_log_write: reservation ran out. Need to up reservation");
> > + xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
> > }
> >
> > /*
> > @@ -1897,21 +1901,8 @@ xlog_write(
> > *start_lsn = 0;
> >
> > len = xlog_write_calc_vec_length(ticket, log_vector);
> > - if (ticket->t_curr_res < len) {
> > + if (ticket->t_curr_res < len)
> > xlog_print_tic_res(log->l_mp, ticket);
>
> Somehow "xlog_print_tic_res" doesn't suggest to me
> that we're going to panic at this point, and I think
> therefore that bit of information is lost with this
> change.

Normally it won't panic - if there is a problem it will shut down
the filesystem. Only if the kernel is a debug kernel or the admin
has specifically set the panic mask to panic on this failure
will there be a panic.

If we start to document every place where there is in shutdown or
panic inside a function call that is not documented at eh function
call site, we won't be able to see the code for the "this might
panic" comments. ;)

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com