[PATCH 3/4] f2fs: fix removing cache entry within proper lock

From: Namjae Jeon
Date: Sun Dec 30 2012 - 00:52:53 EST


From: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>

Cache entry for free NID, is not getting removed under proper
lock in case of error in add_free_nid. So, free the cache entry
first before releasing the spinlock.

Signed-off-by: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
Signed-off-by: Amit Sahrawat <a.sahrawat@xxxxxxxxxxx>
---
fs/f2fs/node.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 5066bfd..09139fb 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1227,8 +1227,8 @@ retry:

spin_lock(&nm_i->free_nid_list_lock);
if (__lookup_free_nid_list(nid, &nm_i->free_nid_list)) {
- spin_unlock(&nm_i->free_nid_list_lock);
kmem_cache_free(free_nid_slab, i);
+ spin_unlock(&nm_i->free_nid_list_lock);
return 0;
}
list_add_tail(&i->list, &nm_i->free_nid_list);
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/