From patchwork Thu Oct 2 16:13:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 5019311 Return-Path: X-Original-To: patchwork-cifs-client@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 3F5379FAE8 for ; Thu, 2 Oct 2014 16:14:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 76DFA201FE for ; Thu, 2 Oct 2014 16:14:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F136C20158 for ; Thu, 2 Oct 2014 16:14:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753330AbaJBQNq (ORCPT ); Thu, 2 Oct 2014 12:13:46 -0400 Received: from mail-la0-f52.google.com ([209.85.215.52]:46432 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753106AbaJBQNq (ORCPT ); Thu, 2 Oct 2014 12:13:46 -0400 Received: by mail-la0-f52.google.com with SMTP id hz20so2665399lab.25 for ; Thu, 02 Oct 2014 09:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=riaLTMo0IsvI/FRbKT88CyQ7DQ55hDt7xsQega1FU4s=; b=UjRYgDczWpyp7BKzvOWCluo4ueOb12tUqa1KEjVRFWbW+Bqit8YS6HfFqcGPT1piK4 gXCaXey7M89md9x7ccBl41JNcfD47XhgKUenBhz0OZPbPJmG1hv5vyOdYdbTVFdk3tcn OEsDWg7PObV4tCfQltdY+JIu1K09ETGIKPPHWbyMINRlpbTr58NXkiMxjPULRh9L8WO8 +9hp9oz2fLHySN9degcB026r5onPJyw+DVP9OoB7I070qkS+PX+i9gN8jjSN2zuA9QNo NM0/YSWekkvU56yB+6+6uwfHL8QEaqvqqOKAhiPGC9wHYSbR0T938vrwIwUmLsQO6Kog XnFg== X-Received: by 10.112.171.229 with SMTP id ax5mr53089431lbc.25.1412266424522; Thu, 02 Oct 2014 09:13:44 -0700 (PDT) Received: from localhost.localdomain (PPPoE-78-29-68-243.san.ru. [78.29.68.243]) by mx.google.com with ESMTPSA id rl6sm1738201lac.17.2014.10.02.09.13.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Oct 2014 09:13:43 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Cc: Pavel Shilovsky Subject: [PATCH] CIFS: Fix readpages retrying on reconnects Date: Thu, 2 Oct 2014 20:13:35 +0400 Message-Id: <1412266416-9172-1-git-send-email-piastry@etersoft.ru> X-Mailer: git-send-email 1.7.10.4 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 From: Pavel Shilovsky If we got a reconnect error from async readv we re-add pages back to page_list and continue loop. That is wrong because these pages have been already added to the pagecache but page_list has pages that have not been added to the pagecache yet. This ends up with a general protection fault in put_pages after readpages. Fix it by not retrying the read of these pages and falling back to readpage instead. Signed-off-by: Pavel Shilovsky --- fs/cifs/file.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 7c018a1..5f29354 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3568,15 +3568,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, lru_cache_add_file(page); unlock_page(page); page_cache_release(page); - if (rc == -EAGAIN) - list_add_tail(&page->lru, &tmplist); } + /* Fallback to the readpage in error/reconnect cases */ kref_put(&rdata->refcount, cifs_readdata_release); - if (rc == -EAGAIN) { - /* Re-add pages to the page_list and retry */ - list_splice(&tmplist, page_list); - continue; - } break; }