From patchwork Mon Jun 4 10:25:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10446285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57B57603D7 for ; Mon, 4 Jun 2018 10:26:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 481DE28BE5 for ; Mon, 4 Jun 2018 10:26:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B95C28BED; Mon, 4 Jun 2018 10:26:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB1C428BE5 for ; Mon, 4 Jun 2018 10:26:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751597AbeFDK0H (ORCPT ); Mon, 4 Jun 2018 06:26:07 -0400 Received: from m6561.mail.qiye.163.com ([123.126.65.61]:42019 "EHLO m6561.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbeFDK0G (ORCPT ); Mon, 4 Jun 2018 06:26:06 -0400 Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp11 (Coremail) with SMTP id WdOowACXlfK3ExVbMR5cAA--.433S2; Mon, 04 Jun 2018 18:26:00 +0800 (CST) From: Dongsheng Yang To: idryomov@gmail.com, jdillama@redhat.com, zyan@redhat.com Cc: ceph-devel@vger.kernel.org, Dongsheng Yang Subject: [PATCH] ceph: don't abort linger request in abort_request() Date: Mon, 4 Jun 2018 06:25:46 -0400 Message-Id: <1528107946-2327-1-git-send-email-dongsheng.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 X-CM-TRANSID: WdOowACXlfK3ExVbMR5cAA--.433S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxAryxZw1xCFWfGw1fCFWruFg_yoW5uFyrpF 43Jw4jkr4kXw1jqF40vFy8Ww18AFsrAFWxXryxtry0qF4UGw4ktryUGFWavF17GF4kJa43 Jw1qgw12qF17JaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0Jb3WrXUUUUU= X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbiWBhbelf4pSitJAAAsK Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a problem if we abort a linger request and then request_reinit(), because abort_request() aborted the osd_request but did not put the lreq->r_klref; Then we will hit this WARN_ON(kref_read(&req->r_kref) != 1); [ 609.492250] WARNING: CPU: 6 PID: 4933 at net/ceph//osd_client.c:558 request_reinit+0x116/0x130 [libceph] [ 609.501561] Modules linked in: rbd(OE) libceph(OE) dns_resolver tcp_diag udp_diag inet_diag unix_diag af_packet_diag netlink_diag ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter sg cfg80211 rfkill snd_hda_codec_generic ext4 snd_hda_intel snd_hda_codec crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_core pcbc mbcache aesni_intel snd_hwdep crypto_simd snd_seq cryptd jbd2 glue_helper snd_seq_device nfsd snd_pcm snd_timer snd virtio_balloon auth_rpcgss pcspkr soundcore i2c_piix4 nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c virtio_blk virtio_console ata_generic pata_acpi 8139too qxl drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm ata_piix libata crc32c_intel virtio_pci i2c_core virtio_ring 8139cp virtio mii floppy serio_raw dm_mirror dm_region_hash [ 609.518259] dm_log dm_mod dax [last unloaded: libceph] [ 609.520015] CPU: 6 PID: 4933 Comm: kworker/6:0 Tainted: G OE 4.17.0-rc6+ #16 [ 609.522261] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 [ 609.524135] Workqueue: events handle_timeout [libceph] [ 609.525887] RIP: 0010:request_reinit+0x116/0x130 [libceph] [ 609.527723] RSP: 0018:ffffaf90833ebd78 EFLAGS: 00010202 [ 609.529502] RAX: 0000000000000002 RBX: ffff89bb140f1f00 RCX: 0000000000000000 [ 609.531576] RDX: 0000000000000000 RSI: ffff89bb5f196978 RDI: ffff89bb5f196978 [ 609.533643] RBP: ffff89bb52b47800 R08: 0000000000000000 R09: 0000000000000000 [ 609.535737] R10: 0000000000000001 R11: 0000000000aaaaaa R12: ffff89baf96632e0 [ 609.537836] R13: 0000000000000001 R14: 0000000000000000 R15: ffff89bb516af768 [ 609.539919] FS: 0000000000000000(0000) GS:ffff89bb5f180000(0000) knlGS:0000000000000000 [ 609.542151] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 609.544009] CR2: 000055ed56747020 CR3: 000000032e00a003 CR4: 00000000000206e0 [ 609.546111] Call Trace: [ 609.547482] handle_timeout+0x4e1/0x750 [libceph] [ 609.549208] ? pick_next_task_fair+0x273/0x630 [ 609.550867] ? __switch_to+0xa8/0x480 [ 609.552422] process_one_work+0x158/0x360 [ 609.554012] worker_thread+0x47/0x3e0 [ 609.555560] kthread+0xf8/0x130 [ 609.557018] ? max_active_store+0x80/0x80 [ 609.558606] ? kthread_bind+0x10/0x10 [ 609.560142] ret_from_fork+0x35/0x40 Signed-off-by: Dongsheng Yang --- net/ceph/osd_client.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index ab287e5..406ecdf 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -2385,6 +2385,9 @@ static void cancel_request(struct ceph_osd_request *req) static void abort_request(struct ceph_osd_request *req, int err) { + if (req->r_linger) + return; + dout("%s req %p tid %llu err %d\n", __func__, req, req->r_tid, err); cancel_map_check(req);