Skip to contentSkip to conversation

GFS2: add error check while allocating new inodes

PATCH New Bob Peterson 2 participants 2 messages Nov 16, 2012 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: add error check while allocating new inodes

Hi,

This patch adds a return code check after attempting to allocate a new inode during dinode creation.

Regards,

Bob Peterson
Red Hat File Systems

---

fs/gfs2/inode.c +4 -0
index e321333..2405695 100644
@@ -674,6 +674,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 		goto fail_gunlock;
 
 	inode = new_inode(sdp->sd_vfs);
+	if (!inode) {
+		gfs2_glock_dq_uninit(ghs);
+		return -ENOMEM;
+	}
 	ip = GFS2_I(inode);
 	error = gfs2_rs_alloc(ip);
 	if (error)
#1 lore raw

PATCH 1/1 GFS2: add error check while allocating new inodes

Hi,

Quoted 10 lines · Bob Peterson

Hi,

This patch adds a return code check after attempting to allocate a new inode during dinode creation.

Regards,

Bob Peterson
Red Hat File Systems

Both patches in the -nmw tree now. Thanks,

Steve.

Quoted 17 lines

---

fs/gfs2/inode.c +4 -0
index e321333..2405695 100644
@@ -674,6 +674,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 		goto fail_gunlock;
 
 	inode = new_inode(sdp->sd_vfs);
+	if (!inode) {
+		gfs2_glock_dq_uninit(ghs);
+		return -ENOMEM;
+	}
 	ip = GFS2_I(inode);
 	error = gfs2_rs_alloc(ip);
 	if (error)