From: Henry C Chang Date: Tue, 15 Mar 2011 09:18:01 +0000 (+0000) Subject: ceph: remove request from unsafe list if it is canceled/timed out X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=78a255654fa7f01945dea0dcedcf5113b3ad9f93;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ceph: remove request from unsafe list if it is canceled/timed out 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: [] warn_slowpath_common+0x7c/0x94 [] warn_slowpath_fmt+0x41/0x43 [] __list_add+0x68/0x81 [] ceph_aio_write+0x614/0x8a2 [ceph] [] do_sync_write+0xe8/0x125 [] ? autoremove_wake_function+0x0/0x39 [] ? selinux_file_permission+0x5c/0xb3 [] ? security_file_permission+0x16/0x18 [] vfs_write+0xae/0x10b [] sys_pwrite64+0x5a/0x76 [] system_call_fastpath+0x16/0x1b ---[ end trace 08573eb9f07ff6f4 ]--- Signed-off-by: Henry C Chang Signed-off-by: Sage Weil --- diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 7d0e4a82d898..db5d86309744 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)