Received: by 10.213.65.68 with SMTP id h4csp1056741imn; Sat, 24 Mar 2018 02:07:58 -0700 (PDT) X-Google-Smtp-Source: AG47ELup3IkTJkYtySg0ENQYk6ElbbFKQde8l+vQqYe1U8q99EQJy9dDuksaZQK9athb/XQYdg7H X-Received: by 2002:a17:902:aa02:: with SMTP id be2-v6mr32906708plb.86.1521882478363; Sat, 24 Mar 2018 02:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521882478; cv=none; d=google.com; s=arc-20160816; b=Mu4JR/zF7aDw89vOl7CIWYvwqyRAYctxTZoCaIkzBqegdYUZt+22NJE6PNBEC0V6tc NbS+L/tDPnPCz6Dc1Ie+CBPTVq5mNRWhawTGm1EZmDchSp/iNdeW2TFVi+qgXiIPxrcJ Gb1Ejk/MQfNZeh/h2L7/MBGrhY1vhklnMCqb8DJTotZO/lLfJexFfCUhiSynxzfoJykr hq0pfj9szhzeHjvHg1DriKjwQGJg2Zu71Bhoi/GImbZxqYyrDYy57Wvup+tuQmEZNqJ2 tsWtzeZFUpzf2w2BzP7shNz7K+mtxRq4i9ROw9/WvVwzma3G/mZL3FMx1fVMVM8e9DcT L+bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=eSrBuTAaNpFx0eaGWDHZNUNqDfpWYi3Q7yQMEZlMD1U=; b=YsBPWVlxppdGl8hXavj3G2aZ8eKdJoKRI4zp0lCtpaIIKMyPJUwq78jaPUnVXVwHwB ov05KCRdh58icTppbcL41Y6vlTKQv1kJpOvNNpWIbY9zV+CviAtlgsIHS9zwgpCdMkzl J4neHLZwp1LgRQ1npQPU4WzuuJbwwYJWTQtNva+jboSwHpjOqpNN32x7opS/YFUjPVnm khjSunWJyjOghyYUM9Ivo0iwv6LOWfEvdZUDsIq7/dxMWVBPUvJs45+LOBZryFDcfRP3 Z8kH0HNjL3iLdPTG54Q4O4d3+guTek+oiFmORRac+N9kBRhyvWQsZ3dLPI4FqCAfA7JX 4dKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si7332505pgn.787.2018.03.24.02.07.44; Sat, 24 Mar 2018 02:07:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751930AbeCXJGq (ORCPT + 99 others); Sat, 24 Mar 2018 05:06:46 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53298 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751733AbeCXJGn (ORCPT ); Sat, 24 Mar 2018 05:06:43 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2F436E2C; Sat, 24 Mar 2018 09:06:42 +0000 (UTC) Date: Sat, 24 Mar 2018 10:06:38 +0100 From: Greg Kroah-Hartman To: "Luis R. Rodriguez" Cc: "Darrick J. Wong" , Christoph Hellwig , xfs , linux-kernel@vger.kernel.org, Sasha Levin , Julia Lawall , Josh Triplett , Takashi Iwai , Michal Hocko , Joerg Roedel Subject: Re: [PATCH] xfs: always free inline data before resetting inode fork during ifree Message-ID: <20180324090638.GB1170@kroah.com> References: <20171123060137.GL2135@magnolia> <20180323013037.GA9190@wotan.suse.de> <20180323034145.GH4818@magnolia> <20180323170813.GD30543@wotan.suse.de> <20180323172620.GK4818@magnolia> <20180323182302.GB9190@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180323182302.GB9190@wotan.suse.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 23, 2018 at 06:23:02PM +0000, Luis R. Rodriguez wrote: > On Fri, Mar 23, 2018 at 10:26:20AM -0700, Darrick J. Wong wrote: > > On Fri, Mar 23, 2018 at 05:08:13PM +0000, Luis R. Rodriguez wrote: > > > On Thu, Mar 22, 2018 at 08:41:45PM -0700, Darrick J. Wong wrote: > > > > On Fri, Mar 23, 2018 at 01:30:37AM +0000, Luis R. Rodriguez wrote: > > > > > On Wed, Nov 22, 2017 at 10:01:37PM -0800, Darrick J. Wong wrote: > > > > > > diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c > > > > > > index 61d1cb7..8012741 100644 > > > > > > --- a/fs/xfs/xfs_inode.c > > > > > > +++ b/fs/xfs/xfs_inode.c > > > > > > @@ -2401,6 +2401,24 @@ xfs_ifree_cluster( > > > > > > } > > > > > > > > > > > > /* > > > > > > + * Free any local-format buffers sitting around before we reset to > > > > > > + * extents format. > > > > > > + */ > > > > > > +static inline void > > > > > > +xfs_ifree_local_data( > > > > > > + struct xfs_inode *ip, > > > > > > + int whichfork) > > > > > > +{ > > > > > > + struct xfs_ifork *ifp; > > > > > > + > > > > > > + if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL) > > > > > > + return; > > > > > > > > > > I'm new to all this so this was a bit hard to follow. I'm confused with how > > > > > commit 43518812d2 ("xfs: remove support for inlining data/extents into the > > > > > inode fork") exacerbated the leak, isn't that commit about > > > > > XFS_DINODE_FMT_EXTENTS? > > > > > > > > Not specifically _EXTENTS, merely any fork (EXTENTS or LOCAL) whose > > > > incore data was small enough to fit in if_inline_ata. > > > > > > Got it, I thought those were XFS_DINODE_FMT_EXTENTS by definition. > > > > > > > > Did we have cases where the format was XFS_DINODE_FMT_LOCAL and yet > > > > > ifp->if_u1.if_data == ifp->if_u2.if_inline_data ? > > > > > > > > An empty directory is 6 bytes, which is what you get with a fresh mkdir > > > > or after deleting everything in the directory. Prior to the 43518812d2 > > > > patch we could get away with not even checking if we had to free if_data > > > > when deleting a directory because it fit within if_inline_data. > > > > > > Ah got it. So your fix *is* also applicable even prior to commit 43518812d2. > > > > You'd have to modify the patch so that it doesn't try to kmem_free > > if_data if if_data == if_inline_data but otherwise (in theory) I think > > that the concept applies to pre-4.15 kernels. > > > > (YMMV, please do run this through QA/kmemleak just in case I'm wrong, etc...) > > Well... so we need a resolution and better get testing this already given that > *I believe* the new auto-selection algorithm used to cherry pick patches onto > stable for linux-4.14.y (covered on a paper [0] and when used, stable patches > are prefixed with AUTOSEL, a recent discussion covered this in November 2017 > [1]) recommended to merge your commit 98c4f78dcdd8 ("xfs: always free inline > data before resetting inode fork during ifree") as stable commit 1eccdbd4836a41 > on v4.14.17 *without* merging commit 43518812d2 ("xfs: remove support for > inlining data/extents into the inode fork"). > > Sasha, Greg, > > Can you confirm if the algorithm was used in this case? No idea. I think xfs should just be added to the "blacklist" so that it is not even looked at for these types of auto-selected patches. Much like the i915 driver currently is handled (it too is ignored for these patches due to objections from the maintainers of it.) thanks, greg k-h