All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] recover from iclog allocation failures
Date: Sat, 9 Feb 2008 01:33:29 -0500	[thread overview]
Message-ID: <20080209063329.GA6840@infradead.org> (raw)
In-Reply-To: <47AD3E11.7020608@redhat.com>

On Fri, Feb 08, 2008 at 11:45:53PM -0600, Eric Sandeen wrote:
>  	mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks);
> +	if (!mp->m_log)
> +		return ENOMEM;

Currently there's no allocations in there that should be able to fail.
But actually marking these KM_MAYFAIL would be a good idea.

> @@ -1219,6 +1221,13 @@ xlog_alloc_log(xfs_mount_t	*mp,
>  		prev_iclog = iclog;
>  
>  		bp = xfs_buf_get_noaddr(log->l_iclog_size, mp->m_logdev_targp);
> +		if (!iclog || !bp) {
> +			if (iclog)
> +				kmem_free(iclog, sizeof(xlog_in_core_t));
> +			log->l_iclog_bufs = i;
> +			xlog_dealloc_log(log);
> +			return NULL;
> +		}

Please check for iclog beeing NULL before trying to allocate the buffer,
and switch it to KM_MAYFAIL.  Given that there are two failing cases now
it would make sense to have goto-unwinding here.

Also once you touch the memory allocation feel free to remove the
useless casts of their return values.

> Index: linux-2.6.24.noarch/fs/xfs/xfs_mount.c
> ===================================================================
> --- linux-2.6.24.noarch.orig/fs/xfs/xfs_mount.c
> +++ linux-2.6.24.noarch/fs/xfs/xfs_mount.c
> @@ -1007,6 +1007,7 @@ xfs_mountfs(
>  			error = XFS_ERROR(EINVAL);
>  			goto error1;
>  		}
> +		uuid_mounted = 1;

How is this related to the rest of the patch?

  reply	other threads:[~2008-02-09  6:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-09  5:45 [PATCH] recover from iclog allocation failures Eric Sandeen
2008-02-09  6:33 ` Christoph Hellwig [this message]
2008-02-09  6:44   ` Eric Sandeen
2008-02-09 20:45     ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080209063329.GA6840@infradead.org \
    --to=hch@infradead.org \
    --cc=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.