Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4787778imm; Fri, 18 May 2018 10:38:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqi75Ec6KsNUFcQq6tYqAVbWxlBRFTmUeflCaRcu6TOH4HcgDnB3iCBDHettDJVXNVQideN X-Received: by 2002:a62:a111:: with SMTP id b17-v6mr10378607pff.132.1526665109334; Fri, 18 May 2018 10:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526665109; cv=none; d=google.com; s=arc-20160816; b=V5AOhFcez/yGIWzuwxcXMw+Zg6nOQwbnSzNsbqUycPn1Uny+rbbWhOBDBV2MR11VsI RygKtetbG8ibfGzRU+2uG2WDshRk/CIrahpdeuochCpfV3JVU68QMt6BzGoqcJmyhjQb mbl5r4hPyPK/LZELd3lcbQKDodiECMj3qbcVgAzVtw0VA0svQIZ0tVwY2NVeopMGH54Q IJVykSnHp8nJogDarrxeQ/d4FqmdBZ7JGqTqWCKgif5/Wb1czx6XzUKpZ35yMg9fIUc7 +bX1wHNNmph9IO8pasl6yoDfc4FU9uzO+H7OpiBxZoJPWuLDTh/1yk78R7hde2JoMgm6 Oj9Q== 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=UDgm2FCK5UKzEwAdkWmtLtWUBwMh0Hw4CFCFkTH8uTQ=; b=hhwMkcOCYKB1fxBOeo0jEnLkVn8yUXBCyBEhBclr6ZHk6oP8V+10xDI/Sa11vzbCJr 83+ieqflM9ikuUGiYeOFixhNC6Nxu4LEFVDU6h03ZCAEWkXK0AwuwjLXKNhTiHHeejXj 4x6DFhVngznsHtkkfgolZPD4wGpdezvk6dOOnZ2UyMozmAMbedkoE/QZfQ58UX//x36c aTtolzNHF3gCGIUqsZBRvDcz1Qn7dwR5eQew8xwGdYkAJurP48ZIzQm0QRlNzXlg4cFK nYn0c0wGh575zfCUkpe1v54X+2njFymaOczwncsnCk3ilABoe8+6Jej0ruEkfsdteKkb bi4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ivTDrCSL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14-v6si7782353plj.146.2018.05.18.10.38.15; Fri, 18 May 2018 10:38:29 -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=@gmail.com header.s=20161025 header.b=ivTDrCSL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751994AbeERRiA (ORCPT + 99 others); Fri, 18 May 2018 13:38:00 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:41511 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751298AbeERRh6 (ORCPT ); Fri, 18 May 2018 13:37:58 -0400 Received: by mail-qk0-f193.google.com with SMTP id d125-v6so7054789qkb.8; Fri, 18 May 2018 10:37:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UDgm2FCK5UKzEwAdkWmtLtWUBwMh0Hw4CFCFkTH8uTQ=; b=ivTDrCSLOHnlcLGna6p+EaQG/m/9mBdJckgdgF3bLK1K/4DWNfc0wLhglfY/LMQN7J N2rbkI2MtZ1NzpxXPvT+lNG355U5knjVCITXbmj9zhwhun+DqVpfACi9rP1r7RwgiTXg imwZMBSvnlfpkoytLN4UZGrVdZj2ydnzF0BqSqIXbDU3DPZ8v3ugHus7k6rmGC3d/k9f Ju2TwPX9iKPsM/hK2OQtXYKagExYDK8SEU+OVIkEFOocU+L36Wb+AQnXO+hccEwx6BZ2 rBiOyr3IsgQGvS0f3UCzCtVlEvnO4A6l26IH7TbVOp5e1SrRcTrrCqjur9UsOEtccrNC 69uQ== 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=UDgm2FCK5UKzEwAdkWmtLtWUBwMh0Hw4CFCFkTH8uTQ=; b=Qwl1pi4FxH3ubarU6yoOGxo+2ruuzg1nma3H6Fk+GTNb6qVeLM8R3dv4Yo1TKcyKPy l7n3NVWRw1x502fC8+emiP7LfOcFKuKBe46BGnc1JLDuF7sMk+1XZ+j24uTkpwuZb6yf bP0JJwfS8etAHDdmw9rSbBpHkRU2GIbwIwfFwquHmfHOKv6rZmUYzgjiJ5kTIWgKNszi wBttIVt9VSTmOm1FwITRYi8Eub2i1r5D4eocUvCjqG1jLniHuoXahO7DS6bUw8ZwlMcR YXhWQoW/7MCvIlM+NKNaTb2PatUbERy0sVmp1nSk/fViHk2RJL9pX6+RrFEN2CL05YUZ lHEA== X-Gm-Message-State: ALKqPwfPPXJtMgt/YruDlJrdHpZSgxeYurnUerJGSAcOJMqCtd6b0gaP 052PCng+GSLSowDORfDC+Q== X-Received: by 2002:a37:8a87:: with SMTP id m129-v6mr9944976qkd.211.1526665077910; Fri, 18 May 2018 10:37:57 -0700 (PDT) Received: from kmo-pixel (c-71-234-172-214.hsd1.vt.comcast.net. [71.234.172.214]) by smtp.gmail.com with ESMTPSA id w124-v6sm5727532qkc.87.2018.05.18.10.37.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 10:37:56 -0700 (PDT) Date: Fri, 18 May 2018 13:37:54 -0400 From: Kent Overstreet To: Christoph Hellwig Cc: 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 10/10] Dynamic fault injection Message-ID: <20180518173754.GB31737@kmo-pixel> References: <20180518074918.13816-1-kent.overstreet@gmail.com> <20180518074918.13816-21-kent.overstreet@gmail.com> <20180518160245.GE22791@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180518160245.GE22791@infradead.org> User-Agent: Mutt/1.9.5 (2018-04-13) 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 09:02:45AM -0700, Christoph Hellwig wrote: > On Fri, May 18, 2018 at 03:49:18AM -0400, Kent Overstreet wrote: > > Signed-off-by: Kent Overstreet > > Completely lacks any explanation or argument why it would be useful. It's in the cover letter... * Dynamic fault injection I've actually had this code sitting in my tree since forever... I know we have an existing fault injection framework, but I think this one is quite a bit nicer to actually use. It works very much like the dynamic debug infrastructure - for those who aren't familiar, dynamic debug makes it so you can list and individually enable/disable every pr_debug() callsite in debugfs. So to add a fault injection site with this, you just stick a call to dynamic_fault("foobar") somewhere in your code - dynamic_fault() returns true if you should fail whatever it is you're testing. And then it'll show up in debugfs, where you can enable/disable faults by file/linenumber, module, name, etc. The patch then also adds macros that wrap all the various memory allocation functions and fail if dynamic_fault("memory") returns true - which means you can see in debugfs every place you're allocating memory and fail all of them or just individually (I have tests that iterate over all the faults and flip them on one by one). I also use it in bcachefs to add fault injection points for uncommon error paths in the filesystem startup/recovery path, and for various hard to test slowpaths that only happen if we race in weird ways (race_fault()).