* [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode @ 2012-07-10 1:03 ` Wanpeng Li 0 siblings, 0 replies; 8+ messages in thread From: Wanpeng Li @ 2012-07-10 1:03 UTC (permalink / raw) To: linux-mm; +Cc: Andrew Morton, William Irwin, linux-kernel, Wanpeng Li From: Wanpeng Li <liwp@linux.vnet.ibm.com> When kmem_cache_alloc fails alloc slab object from hugetlbfs_inode_cachep, return -ENOMEM in usual. But hugetlbfs_alloc_inode implementation has inconsitency with it and returns NULL. Fix it to return -ENOMEM. Signed-off-by: Wanpeng Li <liwp.linux@gmail.com> --- fs/hugetlbfs/inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index c4b85d0..79a0f33 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL); if (unlikely(!p)) { hugetlbfs_inc_free_inodes(sbinfo); - return NULL; + return -ENOMEM; } return &p->vfs_inode; } -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode @ 2012-07-10 1:03 ` Wanpeng Li 0 siblings, 0 replies; 8+ messages in thread From: Wanpeng Li @ 2012-07-10 1:03 UTC (permalink / raw) To: linux-mm; +Cc: Andrew Morton, William Irwin, linux-kernel, Wanpeng Li From: Wanpeng Li <liwp@linux.vnet.ibm.com> When kmem_cache_alloc fails alloc slab object from hugetlbfs_inode_cachep, return -ENOMEM in usual. But hugetlbfs_alloc_inode implementation has inconsitency with it and returns NULL. Fix it to return -ENOMEM. Signed-off-by: Wanpeng Li <liwp.linux@gmail.com> --- fs/hugetlbfs/inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index c4b85d0..79a0f33 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL); if (unlikely(!p)) { hugetlbfs_inc_free_inodes(sbinfo); - return NULL; + return -ENOMEM; } return &p->vfs_inode; } -- 1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode 2012-07-10 1:03 ` Wanpeng Li @ 2012-07-10 1:09 ` Gavin Shan -1 siblings, 0 replies; 8+ messages in thread From: Gavin Shan @ 2012-07-10 1:09 UTC (permalink / raw) To: Wanpeng Li; +Cc: linux-mm, Andrew Morton, William Irwin, linux-kernel On Tue, Jul 10, 2012 at 09:03:04AM +0800, Wanpeng Li wrote: >From: Wanpeng Li <liwp@linux.vnet.ibm.com> > >When kmem_cache_alloc fails alloc slab object from >hugetlbfs_inode_cachep, return -ENOMEM in usual. But >hugetlbfs_alloc_inode implementation has inconsitency >with it and returns NULL. Fix it to return -ENOMEM. > >Signed-off-by: Wanpeng Li <liwp.linux@gmail.com> >--- > fs/hugetlbfs/inode.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > >diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c >index c4b85d0..79a0f33 100644 >--- a/fs/hugetlbfs/inode.c >+++ b/fs/hugetlbfs/inode.c >@@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) > p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL); > if (unlikely(!p)) { > hugetlbfs_inc_free_inodes(sbinfo); >- return NULL; >+ return -ENOMEM; The function is expecting "struct inode *", man. static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) Thanks, Gavin > } > return &p->vfs_inode; > } >-- >1.7.5.4 > >-- >To unsubscribe, send a message with 'unsubscribe linux-mm' in >the body to majordomo@kvack.org. For more info on Linux MM, >see: http://www.linux-mm.org/ . >Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode @ 2012-07-10 1:09 ` Gavin Shan 0 siblings, 0 replies; 8+ messages in thread From: Gavin Shan @ 2012-07-10 1:09 UTC (permalink / raw) To: Wanpeng Li; +Cc: linux-mm, Andrew Morton, William Irwin, linux-kernel On Tue, Jul 10, 2012 at 09:03:04AM +0800, Wanpeng Li wrote: >From: Wanpeng Li <liwp@linux.vnet.ibm.com> > >When kmem_cache_alloc fails alloc slab object from >hugetlbfs_inode_cachep, return -ENOMEM in usual. But >hugetlbfs_alloc_inode implementation has inconsitency >with it and returns NULL. Fix it to return -ENOMEM. > >Signed-off-by: Wanpeng Li <liwp.linux@gmail.com> >--- > fs/hugetlbfs/inode.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > >diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c >index c4b85d0..79a0f33 100644 >--- a/fs/hugetlbfs/inode.c >+++ b/fs/hugetlbfs/inode.c >@@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) > p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL); > if (unlikely(!p)) { > hugetlbfs_inc_free_inodes(sbinfo); >- return NULL; >+ return -ENOMEM; The function is expecting "struct inode *", man. static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) Thanks, Gavin > } > return &p->vfs_inode; > } >-- >1.7.5.4 > >-- >To unsubscribe, send a message with 'unsubscribe linux-mm' in >the body to majordomo@kvack.org. For more info on Linux MM, >see: http://www.linux-mm.org/ . >Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode 2012-07-10 1:09 ` Gavin Shan @ 2012-07-10 1:15 ` Wanpeng Li -1 siblings, 0 replies; 8+ messages in thread From: Wanpeng Li @ 2012-07-10 1:15 UTC (permalink / raw) To: Gavin Shan Cc: linux-mm, Andrew Morton, William Irwin, linux-kernel, Wanpeng Li On Tue, Jul 10, 2012 at 09:09:10AM +0800, Gavin Shan wrote: >On Tue, Jul 10, 2012 at 09:03:04AM +0800, Wanpeng Li wrote: >>From: Wanpeng Li <liwp@linux.vnet.ibm.com> >> >>When kmem_cache_alloc fails alloc slab object from >>hugetlbfs_inode_cachep, return -ENOMEM in usual. But >>hugetlbfs_alloc_inode implementation has inconsitency >>with it and returns NULL. Fix it to return -ENOMEM. >> >>Signed-off-by: Wanpeng Li <liwp.linux@gmail.com> >>--- >> fs/hugetlbfs/inode.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >>diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c >>index c4b85d0..79a0f33 100644 >>--- a/fs/hugetlbfs/inode.c >>+++ b/fs/hugetlbfs/inode.c >>@@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) >> p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL); >> if (unlikely(!p)) { >> hugetlbfs_inc_free_inodes(sbinfo); >>- return NULL; >>+ return -ENOMEM; > >The function is expecting "struct inode *", man. > >static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) > Hmm, replace it by ERR_PTR(-ENOMEM). Regards, Wanpeng Li >Thanks, >Gavin > >> } >> return &p->vfs_inode; >> } >>-- >>1.7.5.4 >> >>-- >>To unsubscribe, send a message with 'unsubscribe linux-mm' in >>the body to majordomo@kvack.org. For more info on Linux MM, >>see: http://www.linux-mm.org/ . >>Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> >> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode @ 2012-07-10 1:15 ` Wanpeng Li 0 siblings, 0 replies; 8+ messages in thread From: Wanpeng Li @ 2012-07-10 1:15 UTC (permalink / raw) To: Gavin Shan Cc: linux-mm, Andrew Morton, William Irwin, linux-kernel, Wanpeng Li On Tue, Jul 10, 2012 at 09:09:10AM +0800, Gavin Shan wrote: >On Tue, Jul 10, 2012 at 09:03:04AM +0800, Wanpeng Li wrote: >>From: Wanpeng Li <liwp@linux.vnet.ibm.com> >> >>When kmem_cache_alloc fails alloc slab object from >>hugetlbfs_inode_cachep, return -ENOMEM in usual. But >>hugetlbfs_alloc_inode implementation has inconsitency >>with it and returns NULL. Fix it to return -ENOMEM. >> >>Signed-off-by: Wanpeng Li <liwp.linux@gmail.com> >>--- >> fs/hugetlbfs/inode.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >>diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c >>index c4b85d0..79a0f33 100644 >>--- a/fs/hugetlbfs/inode.c >>+++ b/fs/hugetlbfs/inode.c >>@@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) >> p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL); >> if (unlikely(!p)) { >> hugetlbfs_inc_free_inodes(sbinfo); >>- return NULL; >>+ return -ENOMEM; > >The function is expecting "struct inode *", man. > >static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) > Hmm, replace it by ERR_PTR(-ENOMEM). Regards, Wanpeng Li >Thanks, >Gavin > >> } >> return &p->vfs_inode; >> } >>-- >>1.7.5.4 >> >>-- >>To unsubscribe, send a message with 'unsubscribe linux-mm' in >>the body to majordomo@kvack.org. For more info on Linux MM, >>see: http://www.linux-mm.org/ . >>Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> >> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode 2012-07-10 1:15 ` Wanpeng Li @ 2012-07-10 2:01 ` David Rientjes -1 siblings, 0 replies; 8+ messages in thread From: David Rientjes @ 2012-07-10 2:01 UTC (permalink / raw) To: Wanpeng Li Cc: Gavin Shan, linux-mm, Andrew Morton, William Irwin, linux-kernel On Tue, 10 Jul 2012, Wanpeng Li wrote: > >>diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c > >>index c4b85d0..79a0f33 100644 > >>--- a/fs/hugetlbfs/inode.c > >>+++ b/fs/hugetlbfs/inode.c > >>@@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) > >> p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL); > >> if (unlikely(!p)) { > >> hugetlbfs_inc_free_inodes(sbinfo); > >>- return NULL; > >>+ return -ENOMEM; > > > >The function is expecting "struct inode *", man. > > > >static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) > > > Hmm, replace it by ERR_PTR(-ENOMEM). > Please listen to the feedback you're getting before you reply. This function is called by alloc_inode(). It tests whether the return value is NULL or not, it doesn't check for PTR_ERR(). It's correct the way it's written and you would have broken it. In the future, please demonstrate how you've tested your patches before proposing them. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode @ 2012-07-10 2:01 ` David Rientjes 0 siblings, 0 replies; 8+ messages in thread From: David Rientjes @ 2012-07-10 2:01 UTC (permalink / raw) To: Wanpeng Li Cc: Gavin Shan, linux-mm, Andrew Morton, William Irwin, linux-kernel On Tue, 10 Jul 2012, Wanpeng Li wrote: > >>diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c > >>index c4b85d0..79a0f33 100644 > >>--- a/fs/hugetlbfs/inode.c > >>+++ b/fs/hugetlbfs/inode.c > >>@@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) > >> p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL); > >> if (unlikely(!p)) { > >> hugetlbfs_inc_free_inodes(sbinfo); > >>- return NULL; > >>+ return -ENOMEM; > > > >The function is expecting "struct inode *", man. > > > >static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) > > > Hmm, replace it by ERR_PTR(-ENOMEM). > Please listen to the feedback you're getting before you reply. This function is called by alloc_inode(). It tests whether the return value is NULL or not, it doesn't check for PTR_ERR(). It's correct the way it's written and you would have broken it. In the future, please demonstrate how you've tested your patches before proposing them. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-07-10 2:01 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-07-10 1:03 [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode Wanpeng Li 2012-07-10 1:03 ` Wanpeng Li 2012-07-10 1:09 ` Gavin Shan 2012-07-10 1:09 ` Gavin Shan 2012-07-10 1:15 ` Wanpeng Li 2012-07-10 1:15 ` Wanpeng Li 2012-07-10 2:01 ` David Rientjes 2012-07-10 2:01 ` David Rientjes
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.