From patchwork Fri Mar 20 21:36:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taesoo Kim X-Patchwork-Id: 6061151 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BBACE9F6E8 for ; Fri, 20 Mar 2015 21:37:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 071EF203F4 for ; Fri, 20 Mar 2015 21:37:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DAAC920515 for ; Fri, 20 Mar 2015 21:37:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751709AbbCTVhI (ORCPT ); Fri, 20 Mar 2015 17:37:08 -0400 Received: from mail-qc0-f181.google.com ([209.85.216.181]:34737 "EHLO mail-qc0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751036AbbCTVhI (ORCPT ); Fri, 20 Mar 2015 17:37:08 -0400 Received: by qcay5 with SMTP id y5so14381868qca.1; Fri, 20 Mar 2015 14:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=emP71GFWyPwhsAdaW9XGiMLsQU1DgkgyYPV8NRaro4c=; b=IjRwqg+YebQ5DlewQuRaubmKqdNJUmQ7Q6ZiojNVs26pW+OQ79dh/TdMRz+nSpq1yS y1X1tnCqz7CrxmaCBTjmFfMqk7J5mhdWQSqH9of6HGTo6h1wEDeDCK/b86bvp28iagl5 EkazIqSTZi/w1v+5OadLiLWZ7wfcciWk5rDI14DGungOWEGPkUiXE11GWZ2M1jdIozj5 y0eHHHiV8023WWnhNPoqoxVlOMgM6R56wsbkfgtzVxYh0rLPRT202OPtAiavBjEgNaKs hjdsvJk5NJ6TNiiCleOkoKi1hthSzCdKjz1HlR/cuZK++ibBSRm6t2fJZVEagdkzgjz/ oXRA== X-Received: by 10.140.28.36 with SMTP id 33mr102375717qgy.6.1426887426946; Fri, 20 Mar 2015 14:37:06 -0700 (PDT) Received: from skynet (nonchalant.gtisc.gatech.edu. [143.215.130.224]) by mx.google.com with ESMTPSA id y17sm3877505qky.8.2015.03.20.14.37.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 14:37:06 -0700 (PDT) Received: by skynet (sSMTP sendmail emulation); Fri, 20 Mar 2015 17:37:04 -0400 From: Taesoo Kim To: zyan@redhat.com, sage@redhat.com, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: taesoo@gatech.edu, changwoo@gatech.edu, sanidhya@gatech.edu, blee@gatech.edu, csong84@gatech.edu, Taesoo Kim Subject: [PATCH 1/1] ceph: properly release page upon error Date: Fri, 20 Mar 2015 17:36:56 -0400 Message-Id: <1426887416-27312-1-git-send-email-tsgatesv@gmail.com> X-Mailer: git-send-email 2.3.3 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When ceph_update_writeable_page fails (including -EAGAIN), it unlocks (w/ unlock_page) the page but does not 'release' (w/ page_cache_release) properly. Upon error, properly set *pagep to NULL, indicating an error. Signed-off-by: Taesoo Kim --- fs/ceph/addr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index fd5599d..89091e3 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1146,6 +1146,10 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping, inode, page, (int)pos, (int)len); r = ceph_update_writeable_page(file, pos, len, page); + if (r) { + page_cache_release(page); + *pagep = NULL; + } } while (r == -EAGAIN); return r;