diff mbox

[1/2] ceph: remove request from unsafe list if it is canceled/timed out

Message ID 1300180682-18749-1-git-send-email-henry_c_chang@tcloudcomputing.com (mailing list archive)
State New, archived
Headers show

Commit Message

Henry Chang March 15, 2011, 9:18 a.m. UTC
None
diff mbox

Patch

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 7d0e4a8..db5d863 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -568,7 +568,14 @@  more:
 			spin_unlock(&ci->i_unsafe_lock);
 			ceph_get_cap_refs(ci, CEPH_CAP_FILE_WR);
 		}
+		
 		ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
+		if (ret < 0 && req->r_safe_callback) {
+			spin_lock(&ci->i_unsafe_lock);
+			list_del_init(&req->r_unsafe_item);
+			spin_unlock(&ci->i_unsafe_lock);
+			ceph_put_cap_refs(ci, CEPH_CAP_FILE_WR);
+		}
 	}
 
 	if (file->f_flags & O_DIRECT)