Skip to contentSkip to conversation

+ ocfs2-iput-inode-alloc-when-failed-locally.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Apr 1, 2014 OCFS2

lore
Share & tools
lore
#0 lore raw

Subject: + ocfs2-iput-inode-alloc-when-failed-locally.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 01 Apr 2014 14:26:05 -0700

The patch titled
Subject: ocfs2: iput inode alloc when failed locally
has been added to the -mm tree. Its filename is
ocfs2-iput-inode-alloc-when-failed-locally.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/ocfs2-iput-inode-alloc-when-failed-locally.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/ocfs2-iput-inode-alloc-when-failed-locally.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: jiangyiwen <[email protected]>
Subject: ocfs2: iput inode alloc when failed locally

In ocfs2_info_handle_freeinode() and ocfs2_test_inode_bit() func, after calls ocfs2_get_system_file_inode() to get inode ref, if calls ocfs2_info_scan_inode_alloc() or ocfs2_inode_lock() failed, we should iput inode alloc to avoid leaking the inode.

---

 fs/ocfs2/ioctl.c    |    5 +++--
 fs/ocfs2/suballoc.c |    1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
fs/ocfs2/ioctl.c renamed from fs/ocfs2/ioctl.c~ocfs2-iput-inode-alloc-when-failed-locally +3 -2
diff -puN fs/ocfs2/ioctl.c~ocfs2-iput-inode-alloc-when-failed-locally fs/ocfs2/ioctl.c
@@ -413,11 +413,12 @@ int ocfs2_info_handle_freeinode(struct i
 		}
 
 		status = ocfs2_info_scan_inode_alloc(osb, inode_alloc, blkno, oifi, i);
-		if (status < 0)
-			goto bail;
 
 		iput(inode_alloc);
 		inode_alloc = NULL;
+
+		if (status < 0)
+			goto bail;
 	}
 
 	o2info_set_request_filled(&oifi->ifi_req);
fs/ocfs2/suballoc.c renamed from fs/ocfs2/suballoc.c~ocfs2-iput-inode-alloc-when-failed-locally +1 -0
diff -puN fs/ocfs2/suballoc.c~ocfs2-iput-inode-alloc-when-failed-locally fs/ocfs2/suballoc.c
@@ -2894,6 +2894,7 @@ int ocfs2_test_inode_bit(struct ocfs2_su
 	status = ocfs2_inode_lock(inode_alloc_inode, &alloc_bh, 0);
 	if (status < 0) {
 		mutex_unlock(&inode_alloc_inode->i_mutex);
+		iput(inode_alloc_inode);
 		mlog(ML_ERROR, "lock on alloc inode on slot %u failed %d\n",
 		     (u32)suballoc_slot, status);
 		goto bail;

_

Patches currently in -mm which might be from [email protected] are

ocfs2-fix-a-tiny-race-when-running-dirop_fileop_racer.patch ocfs2-iput-inode-alloc-when-failed-locally.patch ocfs2-do-not-return-dlm_migrate_response_mastery_ref-to-avoid-endlessloop-during-umount.patch ocfs2-manually-do-the-iput-once-ocfs2_add_entry-failed-in-ocfs2_symlink-and-ocfs2_mknod.patch