lkml.org 
[lkml]   [2012]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH] hugetlbfs: add err code in initializing module
From
On Mon, Mar 12, 2012 at 4:25 AM, David Rientjes <rientjes@google.com> wrote:
>
> The patch looks good, however, we typically do things like
>
>        error = -ENOMEM;
>        hugetlbfs_inode_cachep = kmem_cache_create(...);
>        if (!hugetlbfs_inode_cachep)
>                ...
>
> instead.  Sometimes people grep to see if a call a function that can fail,
> such as kmem_cache_create(), is followed up by a check for NULL and this
> would otherwise fail.
>
>
It is updated, thanks David.

-hd
===cut here===
From: Hillf Danton <dhillf@gmail.com>
Subject: [PATCH] hugetlbfs: add err code in initilizing module

Error code is added if fail to create inode kmem cache, and newly registered
hugetlb FS is unregistered if fail to mount, both for unlikely corner cases.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/fs/hugetlbfs/inode.c Sun Mar 11 12:46:38 2012
+++ b/fs/hugetlbfs/inode.c Mon Mar 12 19:52:16 2012
@@ -997,6 +997,7 @@ static int __init init_hugetlbfs_fs(void
if (error)
return error;

+ error = -ENOMEM;
hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
sizeof(struct hugetlbfs_inode_info),
0, 0, init_once);
@@ -1015,6 +1016,7 @@ static int __init init_hugetlbfs_fs(void
}

error = PTR_ERR(vfsmount);
+ unregister_filesystem(&hugetlbfs_fs_type);

out:
if (error)
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2012-03-12 13:03    [W:0.062 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site