Skip to contentSkip to conversation

nilfs2: nilfs_iget_for_gc() returns ERR_PTR

PATCH In review Dan Carpenter 2 participants 3 messages Nov 23, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nilfs2: nilfs_iget_for_gc() returns ERR_PTR

nilfs_iget_for_gc() returns an ERR_PTR() on failure and doesn't return NULL.

fs/nilfs2/ioctl.c +2 -2
index 3e90f86..5bf426f 100644
@@ -349,8 +349,8 @@ static int nilfs_ioctl_move_blocks(struct super_block *sb,
 		ino = vdesc->vd_ino;
 		cno = vdesc->vd_cno;
 		inode = nilfs_iget_for_gc(sb, ino, cno);
-		if (unlikely(inode = NULL)) {
-			ret = -ENOMEM;
+		if (unlikely(IS_ERR(inode))) {
+			ret = PTR_ERR(inode);
 			goto failed;
 		}
 		do {
#1 lore raw
Quoted 10 lines · Dan Carpenter

nilfs_iget_for_gc() returns an ERR_PTR() on failure and doesn't return NULL.

fs/nilfs2/ioctl.c +0 -0
index 3e90f86..5bf426f 100644

fs/nilfs2/ioctl.c static int nilfs_ioctl_move_blocks(struct super_block *sb, · line 356

Quoted 10 lines
fs/nilfs2/ioctl.c +2 -2
@@ -349,8 +349,8 @@ static int nilfs_ioctl_move_blocks(struct super_block *sb,
 		ino = vdesc->vd_ino;
 		cno = vdesc->vd_cno;
 		inode = nilfs_iget_for_gc(sb, ino, cno);
-		if (unlikely(inode = NULL)) {
-			ret = -ENOMEM;
+		if (unlikely(IS_ERR(inode))) {
+			ret = PTR_ERR(inode);
 			goto failed;
 		}
 		do {

Good catch!

This looks an -rc1 regression brought about by replacement of the gc iget function.

I will send this fix upstream. Thank you.

Ryusuke Konishi

#2 lore raw
In reply to Dan Carpenter
Quoted 24 lines · Ryusuke Konishi
Quoted 10 lines · Dan Carpenter

nilfs_iget_for_gc() returns an ERR_PTR() on failure and doesn't return NULL.

fs/nilfs2/ioctl.c +0 -0
index 3e90f86..5bf426f 100644

fs/nilfs2/ioctl.c static int nilfs_ioctl_move_blocks(struct super_block *sb, · line 356

Quoted 10 lines
fs/nilfs2/ioctl.c +2 -2
@@ -349,8 +349,8 @@ static int nilfs_ioctl_move_blocks(struct super_block *sb,
 		ino = vdesc->vd_ino;
 		cno = vdesc->vd_cno;
 		inode = nilfs_iget_for_gc(sb, ino, cno);
-		if (unlikely(inode = NULL)) {
-			ret = -ENOMEM;
+		if (unlikely(IS_ERR(inode))) {
+			ret = PTR_ERR(inode);
 			goto failed;
 		}
 		do {

Good catch!

Quoted 6 lines

This looks an -rc1 regression brought about by replacement of the gc iget function.

I will send this fix upstream. Thank you.

Ryusuke Konishi

I'll add a minor amendment to your patch because IS_ERR() implies unlikely().

Thanks,
Ryusuke Konishi

---
From: Dan Carpenter <[email protected]>

nilfs2: nilfs_iget_for_gc() returns ERR_PTR

nilfs_iget_for_gc() returns an ERR_PTR() on failure and doesn't return NULL.

---
 fs/nilfs2/ioctl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nilfs2/ioctl.c +2 -2
index 3e90f86..e00d945 100644
@@ -349,8 +349,8 @@ static int nilfs_ioctl_move_blocks(struct super_block *sb,
 		ino = vdesc->vd_ino;
 		cno = vdesc->vd_cno;
 		inode = nilfs_iget_for_gc(sb, ino, cno);
-		if (unlikely(inode = NULL)) {
-			ret = -ENOMEM;
+		if (IS_ERR(inode)) {
+			ret = PTR_ERR(inode);
 			goto failed;
 		}
 		do {
Signature · 1 line
1.7.3.2