From patchwork Mon Apr 15 16:18:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2446251 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0F6C1DF2E5 for ; Mon, 15 Apr 2013 16:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755875Ab3DOQSG (ORCPT ); Mon, 15 Apr 2013 12:18:06 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:39562 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755472Ab3DOQSE (ORCPT ); Mon, 15 Apr 2013 12:18:04 -0400 Received: by mail-ie0-f181.google.com with SMTP id as1so1553125iec.26 for ; Mon, 15 Apr 2013 09:18:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:content-type:content-transfer-encoding:x-gm-message-state; bh=2F2EPVWDt2tokwnKSxYDU/PWdLiCU41ZyMoZRBu/3jI=; b=Ll/4xjCZp9XaAdyOuwXChdWOtowr6kJU0cMlSO8sa1aQCZ8oYnBjkh3T5V90EVFshs ecIsMyu9o87EyrgMv1zMoc0+z6uDL74QpZIzW5+vZk6mEMAaD4tDCexwBXmHzgo/aYsm RMbDDX0z2v9cm7BBT1pZL5KJL/6o0y8F7Hy+TyQBiXkdOg1JQUlIlMDo0Ze5DmMdveYJ EnxsWBGipP8t3AW3IvLyvmfKjltXIJBjb89CE97HdgL2YjNPeOE8TI+xs+8su17pErwA b9R9k9KmJoHhwqbreNvHRooclpUYVwgaP5GhbGUvnkIYzKGl8Ab7v5t35kPyKXpK6slt u+FQ== X-Received: by 10.50.153.232 with SMTP id vj8mr5741788igb.2.1366042681934; Mon, 15 Apr 2013 09:18:01 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id a3sm12779078igq.5.2013.04.15.09.18.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Apr 2013 09:18:01 -0700 (PDT) Message-ID: <516C2839.7050705@inktank.com> Date: Mon, 15 Apr 2013 11:18:01 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org CC: "Yan, Zheng" Subject: [PATCH] ceph: let osd client clean up for interrupted request X-Gm-Message-State: ALoCoQkCYhOkLscRsSiV64ZjwlyhLc1pqEfhdeuvj2BtgrCQw5tFxHApKkkkYIxPsW/AlEXFgGMa Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org In ceph_sync_write(), if a safe callback is supplied with a request, and an error is returned by ceph_osdc_wait_request(), a block of code is executed to remove the request from the unsafe writes list and drop references to capabilities acquired just prior to a call to ceph_osdc_wait_request(). The only function used for this callback is sync_write_commit(), and it does *exactly* what that block of error handling code does. Now in ceph_osdc_wait_request(), if an error occurs (due to an interupt during a wait_for_completion_interruptible() call), complete_request() gets called, and that calls the request's safe_callback method if it's defined. So this means that this cleanup activity gets called twice in this case, which is erroneous (and in fact leads to a crash). Fix this by just letting the osd client handle the cleanup in the event of an interrupt. This resolves one problem mentioned in: http://tracker.ceph.com/issues/4706 Signed-off-by: Alex Elder Reviewed-by: Yan, Zheng --- fs/ceph/file.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index b7e6caa..1d8d430 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -595,12 +595,6 @@ more: } 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)