ceph: remove request from unsafe list if it is canceled/timed out
authorHenry C Chang <henry.cy.chang@gmail.com>
Tue, 15 Mar 2011 09:18:01 +0000 (09:18 +0000)
committerSage Weil <sage@newdream.net>
Mon, 21 Mar 2011 19:24:24 +0000 (12:24 -0700)
This fixes the list corruption warning like this:

------------[ cut here ]------------
WARNING: at lib/list_debug.c:30 __list_add+0x68/0x81()
Hardware name: X8DTU
list_add corruption. prev->next should be next (ffff880618931250), but was (null). (prev=ffff880c188b9130).
Modules linked in: nfsd lockd nfs_acl auth_rpcgss exportfs ceph libceph libcrc32c sunrpc ipv6 fuse igb i2c_i801 ioatdma i2c_core iTCO_wdt iTCO_vendor_support joydev dca serio_raw usb_storage [last unloaded: scsi_wait_scan]
Pid: 10977, comm: smbd Tainted: G        W  2.6.32.23-170.Elaster.xendom0.fc12.x86_64 #1
Call Trace:
[<ffffffff8105753c>] warn_slowpath_common+0x7c/0x94
[<ffffffff810575ab>] warn_slowpath_fmt+0x41/0x43
[<ffffffff812351a3>] __list_add+0x68/0x81
[<ffffffffa014799d>] ceph_aio_write+0x614/0x8a2 [ceph]
[<ffffffff8111d2a0>] do_sync_write+0xe8/0x125
[<ffffffff81075a1f>] ? autoremove_wake_function+0x0/0x39
[<ffffffff811f21ec>] ? selinux_file_permission+0x5c/0xb3
[<ffffffff811e8521>] ? security_file_permission+0x16/0x18
[<ffffffff8111d864>] vfs_write+0xae/0x10b
[<ffffffff8111d91b>] sys_pwrite64+0x5a/0x76
[<ffffffff81012d32>] system_call_fastpath+0x16/0x1b
---[ end trace 08573eb9f07ff6f4 ]---

Signed-off-by: Henry C Chang <henry_c_chang@tcloudcomputing.com>
Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/file.c

index 7d0e4a8..db5d863 100644 (file)
@@ -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)