xfs
[Top] [All Lists]

[PATCH] recover from iclog allocation failures

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] recover from iclog allocation failures
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Fri, 08 Feb 2008 23:45:53 -0600
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)
A user in #xfs had some strange thing hogging up vmalloc
space, and after mounting several xfs filesystems with 
aggressive log memory usage, started hitting vmalloc failures 
which led to an oops.

I inserted a fake failure at i=3 in the iclog alloc loop, and 
this patch let me exit with a graceful "ENOMEM" instead of an 
oops.

Also, somehow the use of "uuid_mounted" has gone stale; after
the graceful mount failure, I got dup uuid errors on the next
mount.  This patch fixes that problem as well.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>

---

Index: linux-2.6.24.noarch/fs/xfs/xfs_log.c
===================================================================
--- linux-2.6.24.noarch.orig/fs/xfs/xfs_log.c
+++ linux-2.6.24.noarch/fs/xfs/xfs_log.c
@@ -513,6 +513,8 @@ xfs_log_mount(xfs_mount_t   *mp,
        }
 
        mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks);
+       if (!mp->m_log)
+               return ENOMEM;
 
        /*
         * skip log recovery on a norecovery mount.  pretend it all
@@ -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;
+               }
                if (!XFS_BUF_CPSEMA(bp))
                        ASSERT(0);
                XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
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;
        }
 
        /*


<Prev in Thread] Current Thread [Next in Thread>