Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4812737imm; Fri, 18 May 2018 11:04:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpXMrcMuxtw9PqxEJWXbhRpBFmiXyRF4RcYC4VLeCKx1V6Z+n7FfNKpyHnejID/IqLl6gBu X-Received: by 2002:a62:9b8d:: with SMTP id e13-v6mr10474279pfk.157.1526666643437; Fri, 18 May 2018 11:04:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526666643; cv=none; d=google.com; s=arc-20160816; b=OgvNaJ7tDgf6U5CSWLwWTd+q3hlARRP7MAPBqSpPlFVG+4jqhqZgZlhh+H4uPhDNCY DR0pxxMvOzFMIip9WI5BHAPphNHYKy+i4qSEd/IZ27O0Hqx4YUTE/TNU49HGF9mFY4BH C3Qgm69nOHmFa6JLtu0WMXr7+Oi43YVuHw9tp/ORt42ZwO6KZm/Zguc1fWxWaCjUXA6h 4E6CVcUSd2go+Fb1mmxBGAzZdnenQq/M/Fu4XtD6oQtgvtmqG3ex8OQNI4TEDif6YdEc rMtSxafb47SbtAqL+GWD/r5LG1y8Kbl2/xUqFTAug/jl9O35nJAmqgehCkWrCdlAsyvw h3Eg== 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:dkim-signature:arc-authentication-results; bh=LFn7NKviOGy+Aukqe79ZW/4JPEIg9CZnvM0R2Z8ldt8=; b=TWA/crguIx4zBdnlaqtN+26wMePfEtc2S91wjY3C+QnzHqLjL120Y+U49Y4Gp7K+bx G8Q6aKDZqaBrkkN55KcfkJj6c4swAie4nXzQxUBAO4/A6UlZVBugCggJwKZSQHKyCMrY +euQGp/EiXY0hzegHZycG0vnM2wWtanSKn1uqX0enSKYdfDWh8C3Cl1Gd3AEvQqineHL KHy0CJIDE9art4nkubzD/ePUZlhE4ggu9r/etzVkusFvYJ/W/6BrhLDXioouK8zCdVSs T9vmIjar2TP9qpXRYcnOmNQSPxP7yKvaO0LpX4Oh3Coc5vf1rCUFHE/oF5nagdaan52h FVGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=ae7DB8NX; 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 e9-v6si7670196pln.72.2018.05.18.11.03.48; Fri, 18 May 2018 11:04:03 -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; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=ae7DB8NX; 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 S1751899AbeERSDc (ORCPT + 99 others); Fri, 18 May 2018 14:03:32 -0400 Received: from mail-qt0-f178.google.com ([209.85.216.178]:42178 "EHLO mail-qt0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbeERSD1 (ORCPT ); Fri, 18 May 2018 14:03:27 -0400 Received: by mail-qt0-f178.google.com with SMTP id c2-v6so11383550qtn.9 for ; Fri, 18 May 2018 11:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=LFn7NKviOGy+Aukqe79ZW/4JPEIg9CZnvM0R2Z8ldt8=; b=ae7DB8NXMaRexopewDuqlB9DZ1+QdzEINw1NOeNzEr+1SEUIakmRjpASe5ZnISjPWw 9KqbJ0RU0zEkyLj0ChNrKhELrm5ASljACZqgvrL+p6dynSm44Uty4DInPXdo8O2jw2aN g7BUJcYtcdlL0mzNoZKldPsyPTAj+XU9thiPFfSbhGY+2/6uqVJaeQbHtaGP/H4K/oOg CA4+952hkeJbhedccR26qddvIHFCgxEbe/V5F/uxQopJ4N8x2Xg5EWODrKoxT40BB0R/ xHLaLSLZZux7NFzBXQz2nh4E7uNz89i0NemWGeW3s3ww69GhDfj6M9+agbZ2VWTxBz20 737g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=LFn7NKviOGy+Aukqe79ZW/4JPEIg9CZnvM0R2Z8ldt8=; b=MzXWsNiZXOCD3WsxLGtqO+2WVFwrJWdEY8+2wGjxJnZwT6UOYoDtRRDwvjU+JZWNcO DY7hJqR0a4jstXvYwwDh5Izbv30Az6qJsSF0GdtbFCjKkbnGVzETKvYyV3HNAUyxIkhK ns9v+mifUdtq1xpL/OKYFFr267BXUdWediHRP2KEe+s2AHGDCbXQ7FweOk3XkVxV1Gj1 npMa995ALYMeXCICR4bOs/9y/w5CZCVp/1uqQ2ItssJHXgZQfp8Df/PtmYjVcfNc8QBG oy8G5ZGtRwbuj9g8Y85jpn+WEvtOThgNIP6gXBVhYH5txHFCR5hWeGkcY4AAnv92G+Kl DMcw== X-Gm-Message-State: ALKqPwfwCP9sauU3KMOWlq24CiRPgtIIDTGXi2xKovC3Y7u28DcPeWhS jHBDF5dkk0C1rsgZGGwhJ9Lr4Q== X-Received: by 2002:a0c:d00b:: with SMTP id u11-v6mr9898359qvg.22.1526666606454; Fri, 18 May 2018 11:03:26 -0700 (PDT) Received: from localhost (cpe-2606-A000-4381-1201-225-22FF-FEB3-E51A.dyn6.twc.com. [2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id h12-v6sm6423471qth.6.2018.05.18.11.03.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 11:03:25 -0700 (PDT) Date: Fri, 18 May 2018 14:03:25 -0400 From: Josef Bacik To: Kent Overstreet Cc: Josef Bacik , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Dave Chinner , darrick.wong@oracle.com, tytso@mit.edu, linux-btrfs@vger.kernel.org, clm@fb.com, jbacik@fb.com, viro@zeniv.linux.org.uk, willy@infradead.org, peterz@infradead.org Subject: Re: [PATCH 00/10] RFC: assorted bcachefs patches Message-ID: <20180518180324.ymwbajfw5wsfrlth@destiny> References: <20180518074918.13816-1-kent.overstreet@gmail.com> <20180518174536.ai26bg3bhlvzq4pi@destiny> <20180518174912.GE31737@kmo-pixel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180518174912.GE31737@kmo-pixel> User-Agent: NeoMutt/20170714 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 18, 2018 at 01:49:12PM -0400, Kent Overstreet wrote: > On Fri, May 18, 2018 at 01:45:36PM -0400, Josef Bacik wrote: > > On Fri, May 18, 2018 at 03:48:58AM -0400, Kent Overstreet wrote: > > > These are all the remaining patches in my bcachefs tree that touch stuff outside > > > fs/bcachefs. Not all of them are suitable for inclusion as is, I wanted to get > > > some discussion first. > > > > > > * pagecache add lock > > > > > > This is the only one that touches existing code in nontrivial ways. The problem > > > it's solving is that there is no existing general mechanism for shooting down > > > pages in the page and keeping them removed, which is a real problem if you're > > > doing anything that modifies file data and isn't buffered writes. > > > > > > Historically, the only problematic case has been direct IO, and people have been > > > willing to say "well, if you mix buffered and direct IO you get what you > > > deserve", and that's probably not unreasonable. But now we have fallocate insert > > > range and collapse range, and those are broken in ways I frankly don't want to > > > think about if they can't ensure consistency with the page cache. > > > > > > Also, the mechanism truncate uses (i_size and sacrificing a goat) has > > > historically been rather fragile, IMO it might be a good think if we switched it > > > to a more general rigorous mechanism. > > > > > > I need this solved for bcachefs because without this mechanism, the page cache > > > inconsistencies lead to various assertions popping (primarily when we didn't > > > think we need to get a disk reservation going by page cache state, but then do > > > the actual write and disk space accounting says oops, we did need one). And > > > having to reason about what can happen without a locking mechanism for this is > > > not something I care to spend brain cycles on. > > > > > > That said, my patch is kind of ugly, and it requires filesystem changes for > > > other filesystems to take advantage of it. And unfortunately, since one of the > > > code paths that needs locking is readahead, I don't see any realistic way of > > > implementing the locking within just bcachefs code. > > > > > > So I'm hoping someone has an idea for something cleaner (I think I recall > > > Matthew Wilcox saying he had an idea for how to use xarray to solve this), but > > > if not I'll polish up my pagecache add lock patch and see what I can do to make > > > it less ugly, and hopefully other people find it palatable or at least useful. > > > > > > * lglocks > > > > > > They were removed by Peter Zijlstra when the last in kernel user was removed, > > > but I've found them useful. His commit message seems to imply he doesn't think > > > people should be using them, but I'm not sure why. They are a bit niche though, > > > I can move them to fs/bcachefs if people would prefer. > > > > > > * Generic radix trees > > > > > > This is a very simple radix tree implementation that can store types of > > > arbitrary size, not just pointers/unsigned long. It could probably replace > > > flex arrays. > > > > > > * Dynamic fault injection > > > > > > > I've not looked at this at all so this may not cover your usecase, but I > > implemeted a bpf_override_return() to do focused error injection a year ago. I > > have this script > > > > https://github.com/josefbacik/debug-scripts/blob/master/inject-error.py > > > > that does it generically, all you have to do is tag the function you want to be > > error injectable with ALLOW_ERROR_INJECTION() and then you get all these nice > > things like a debugfs interface to trigger them or use the above script to > > trigger specific errors and such. Thanks, > > That sounds pretty cool... > > What about being able to add a random fault injection point in the middle of an > existing function? Being able to stick race_fault() in random places was a > pretty big win in terms of getting good code coverage out of realistic tests. There's nothing stopping us from doing that, it just uses a kprobe to override the function with our helper, so we could conceivably put it anywhere in the function. The reason I limited it to individual functions was because it was easier than trying to figure out the side-effects of stopping mid-function. If I needed to fail mid-function I just added a helper where I needed it and failed that instead. I imagine safety is going to be of larger concern if we allow bpf scripts to randomly return anywhere inside a function, even if the function is marked as allowing error injection. Thanks, Josef