From patchwork Thu Aug 8 07:32:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 2840816 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E977C9F479 for ; Thu, 8 Aug 2013 07:32:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4293C201F5 for ; Thu, 8 Aug 2013 07:32:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0C4F201E5 for ; Thu, 8 Aug 2013 07:32:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757013Ab3HHHcY (ORCPT ); Thu, 8 Aug 2013 03:32:24 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:42083 "EHLO mail-pb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211Ab3HHHcY (ORCPT ); Thu, 8 Aug 2013 03:32:24 -0400 Received: by mail-pb0-f45.google.com with SMTP id mc17so2833170pbc.32 for ; Thu, 08 Aug 2013 00:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:reply-to:subject:mime-version:message-id :content-type:content-transfer-encoding; bh=9+IE/99Z9U3USbCttmpfzx5uZVYikVsQygpF6QgTzBM=; b=axa9qzQlXop1673nxSccYa/qV1VEQYHvkgk7lgCYQ95u5jumb1yLApi6myGIsZCNOy vcFiGvxU+XMgvyyeIV9pOlVxyNxgjluNeSQscpdgILANsnKu0B2xIrTa7AX7wl5NMkdX hnqW4juNNyqPYtc2a0y/lviKWmLgVUUuAyOs9VuSvY8tUGwsIow1L1hDI23VGBvBn+5Q 0OvKgeWreX+L5T9sCBRjbR4Kiaj1RLbK4bL5ivAIspw3ripieCkTgDNF4bG9xZ9ctxG7 QYZC/lfR5evsCXUzVnnoXFK3cWaF6Wol+hV/kcmeXm4qvOSYWTkh+uM7Li3RrV03ZUrt 1wKg== X-Received: by 10.68.253.161 with SMTP id ab1mr4594191pbd.76.1375947143621; Thu, 08 Aug 2013 00:32:23 -0700 (PDT) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id sp4sm12547549pbc.45.2013.08.08.00.32.19 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 08 Aug 2013 00:32:22 -0700 (PDT) Date: Thu, 8 Aug 2013 15:32:19 +0800 From: majianpeng To: sage Cc: ceph-devel Reply-To: majianpeng Subject: [PATCH TRIVIVAL] ceph: Move the place for EOLDSNAPC handle in ceph_aio_write to easily understand X-Priority: 3 X-GUID: CAFD572C-2AA5-44D8-92F8-2E595AD2EA5F X-Has-Attach: no X-Mailer: Foxmail 7.0.1.93[cn] Mime-Version: 1.0 Message-ID: <201308081532168498411@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MIME_BASE64_TEXT, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID,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 Only for ceph_sync_write, the osd can return EOLDSNAPC.so move the related codes after the call ceph_sync_write. Signed-off-by: Jianpeng Ma --- fs/ceph/file.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -- 1.8.3.rc1.44.gb387c77 diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 2ddf061..30e959f 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -768,6 +768,15 @@ retry_snap: mutex_unlock(&inode->i_mutex); written = ceph_sync_write(file, iov->iov_base, count, pos, &iocb->ki_pos); + if (written == -EOLDSNAPC) { + dout("aio_write %p %llx.%llx %llu~%u" + "got EOLDSNAPC, retrying\n", + inode, ceph_vinop(inode), + pos, (unsigned)iov->iov_len); + mutex_lock(&inode->i_mutex); + hold_mutex = true; + goto retry_snap; + } } else { written = generic_file_buffered_write(iocb, iov, nr_segs, pos, &iocb->ki_pos, @@ -797,14 +806,7 @@ retry_snap: if (err < 0) written = err; } - - if (written == -EOLDSNAPC) { - dout("aio_write %p %llx.%llx %llu~%u got EOLDSNAPC, retrying\n", - inode, ceph_vinop(inode), pos, (unsigned)iov->iov_len); - mutex_lock(&inode->i_mutex); - hold_mutex = true; - goto retry_snap; - } + out: if (hold_mutex) mutex_unlock(&inode->i_mutex);