[PATCH][TRIVIAL] ceph: Free the previous caps if alloc failed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jianpeng Ma <majianpeng@xxxxxxxxx>
---
 fs/ceph/caps.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index da0f9b8..626b0ec 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -203,6 +203,11 @@ out_alloc_count:
 	/* we didn't manage to reserve as much as we needed */
 	pr_warning("reserve caps ctx=%p ENOMEM need=%d got=%d\n",
 		   ctx, need, have);
+	if (alloc) {
+		struct ceph_cap *tmp;
+		list_for_each_entry_safe(cap, tmp, &newcaps, caps_item)
+			kmem_cache_free(ceph_cap_cachep, cap);
+	}
 	return ret;
 }
 
-- 
1.8.1.2
?韬{.n?????%??檩??w?{.n????u朕?Ф?塄}?财??j:+v??????2??璀??摺?囤??z夸z罐?+?????w棹f





[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux