mm/hugetlb: fix error code in hugetlbfs_alloc_inode
Subsystems (2)
PATCH v2 1/1 mm/hugetlb: fix error code in hugetlbfs_alloc_inode
From: Wanpeng Li <[email protected]>
Changelog:
*v2 change -ENOMEM to ERR_PTR(-ENOMEM);
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.
--- fs/hugetlbfs/inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/hugetlbfs/inode.c +1 -1
@@ -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 ERR_PTR (-ENOMEM ); }return &p->vfs_inode; }
Signature · 7 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
fs/hugetlbfs/inode.c static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) · line 702
Quoted 13 lines · Wanpeng Li
fs/hugetlbfs/inode.c +1
-1@@ -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 ERR_PTR (-ENOMEM ); }return &p->vfs_inode; }
So now you've removed Gavin Shan who already told you that it was correct as written and propose yet another bogus patch which will break. This isn't professional.
alloc_inode() tests for a NULL return value, not for PTR_ERR(), so you would be introducing a bug if this patch were merged. It's completely correct the way it's written.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 20 lines · David Rientjes
fs/hugetlbfs/inode.c static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) · line 702
Quoted 13 lines · Wanpeng Li
fs/hugetlbfs/inode.c +1
-1@@ -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 ERR_PTR (-ENOMEM ); }return &p->vfs_inode; }So now you've removed Gavin Shan who already told you that it was correct as written and propose yet another bogus patch which will break. This isn't professional.
Quoted 3 lines
alloc_inode()tests for a NULL return value, not forPTR_ERR(), so you would be introducing a bug if this patch were merged. It's completely correct the way it's written.
Thank you for your comments David, please ignore the patch.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>