From patchwork Wed Mar 16 14:21:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 8601071 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 02493C0553 for ; Wed, 16 Mar 2016 14:22:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EA02202F2 for ; Wed, 16 Mar 2016 14:22:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39662202AE for ; Wed, 16 Mar 2016 14:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966678AbcCPOWC (ORCPT ); Wed, 16 Mar 2016 10:22:02 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:36825 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966494AbcCPOWA (ORCPT ); Wed, 16 Mar 2016 10:22:00 -0400 Received: by mail-wm0-f45.google.com with SMTP id l124so50677691wmf.1 for ; Wed, 16 Mar 2016 07:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yZAWEWWP5IMXdebZZJKj74UWpOS+VPg6e0mtNO5HDfQ=; b=KDoz0TuXhzlhEbrWzfm1OfXW+5zmYVzcPNQfLXFVbDzl6iII9urWFqAie8Ug93uL7b 8Z1oZAoN/CCbZIxu/pymJhdwq4Pv6ocyLW01Y3lxYFEtNG4p1PKKlzys5EskTTeNkgNN hK9SkHXT+trBilvxHX7+0KNqAs83HsxAyxMjI42cC9TGgpgoQCW6tT0LBOja4SFAbrVZ k1lufpCgNQ8lDu6Rb4vzKrEtD3SEGIqrlynFWY1iyGDNc3i/Sh05QHeKessBsJJjz9XS jY6Ho1PUC2QFbt3yPEsAQ7LpDuFS1aNvZkKALl534G4Uw+rL0qAkVVwZHJQHiWDNpaAv n0eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yZAWEWWP5IMXdebZZJKj74UWpOS+VPg6e0mtNO5HDfQ=; b=E3GOP6SYD6qAiUWwTx8l1wF0pmhOFxb7kI81EgfZuhrbtoPC3O0KyR/ytzxFU6HqjF rMjRUusgs4tzpHAnsC3krdBKq59j+GUrn1p5o9gK2pBOZK3rNejO6JUNkfhp3ZQ7be2r cpClwUdACbFutrhVXUROiomCddG3gvlTn670Erxk8C+OCBor6FiMghtOKk3b58kxdwV+ nD4a5IS0XAX7e2GfKlpOy0LV4jWbcVPhf9D1eUrZWb2t2Qmz0Hll7OuH+uHaGJyBecA/ a87yvb920yAHalWa8a060z0maIXObf4we9sFs2HeBgeX07NfLHmw9TK3N3Wb0h0hsOYP OZbw== X-Gm-Message-State: AD7BkJL5nTksfri/AdSznxb2C6LWaXpA03wnOYoibtJaloujoU0s4NEBGE6UBaZCOrJpXQ== X-Received: by 10.28.92.195 with SMTP id q186mr4594308wmb.37.1458138118650; Wed, 16 Mar 2016 07:21:58 -0700 (PDT) Received: from node.shutemov.name ([37.44.77.253]) by smtp.gmail.com with ESMTPSA id i5sm3273646wja.23.2016.03.16.07.21.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Mar 2016 07:21:57 -0700 (PDT) Received: by node.shutemov.name (Postfix, from userid 1000) id 5C699648D520; Wed, 16 Mar 2016 17:21:56 +0300 (MSK) Date: Wed, 16 Mar 2016 17:21:56 +0300 From: "Kirill A. Shutemov" To: Richard Weinberger Cc: Christoph Hellwig , linux-fsdevel , "linux-mtd@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Boris Brezillon , Maxime Ripard , David Gstir , Dave Chinner , Artem Bityutskiy , "Kirill A. Shutemov" , Alexander Kaplan Subject: Re: Page migration issue with UBIFS Message-ID: <20160316142156.GA23595@node.shutemov.name> References: <56E8192B.5030008@nod.at> <20160315151727.GA16462@node.shutemov.name> <56E82B18.9040807@nod.at> <20160315153744.GB28522@infradead.org> <56E8985A.1020509@nod.at> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <56E8985A.1020509@nod.at> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_WEB,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 On Wed, Mar 16, 2016 at 12:18:50AM +0100, Richard Weinberger wrote: > Am 15.03.2016 um 16:37 schrieb Christoph Hellwig: > > On Tue, Mar 15, 2016 at 04:32:40PM +0100, Richard Weinberger wrote: > >>> Or if ->page_mkwrite() was called, why the page is not dirty? > >> > >> BTW: UBIFS does not implement ->migratepage(), could this be a problem? > > > > This might be the reason. I can't reall make sense of > > buffer_migrate_page, but it seems to migrate buffer_head state to > > the new page. > > > > I'd love to know why CMA even tries to migrate pages that don't have a > > ->migratepage method, this seems incredibly dangerous to me. > > FYI, with a dummy ->migratepage() which returns only -EINVAL UBIFS does no > longer explode upon page migration. > Tomorrow I'll do more tests to make sure. Could you check if something like this would fix the issue. Completely untested. diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 065c88f8e4b8..9da34120dc5e 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -52,6 +52,7 @@ #include "ubifs.h" #include #include +#include static int read_block(struct inode *inode, void *addr, unsigned int block, struct ubifs_data_node *dn) @@ -1452,6 +1453,20 @@ static int ubifs_set_page_dirty(struct page *page) return ret; } +static int ubifs_migrate_page(struct address_space *mapping, + struct page *newpage, struct page *page, enum migrate_mode mode) +{ + if (PagePrivate(page)) { + SetPagePrivate(newpage); + __set_page_dirty_nobuffers(newpage); + } + + if (PageChecked(page)) + SetPageChecked(newpage); + + return migrate_page(mapping, newpage, page, mode); +} + static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags) { /* @@ -1591,6 +1606,7 @@ const struct address_space_operations ubifs_file_address_operations = { .write_end = ubifs_write_end, .invalidatepage = ubifs_invalidatepage, .set_page_dirty = ubifs_set_page_dirty, + .migratepage = ubifs_migrate_page, .releasepage = ubifs_releasepage, };