Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1145361imm; Tue, 15 May 2018 14:36:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZppH9F9vStkUwxG8JngJRsZ4AHy2XrQ48PvGWZUAJFCUx/RPEmSMBqQsxfLxp7MVhC26M8j X-Received: by 2002:a63:43c6:: with SMTP id q189-v6mr14003132pga.123.1526420173223; Tue, 15 May 2018 14:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526420173; cv=none; d=google.com; s=arc-20160816; b=SjR2Mobp7JtsAtmI7EuAEeuk24oSOCV4T92PWNptScQ4IOqyyq0h7GuPghPAjCoU4b QVOHjJPUOoLai+IKgaGT2RC4MC2xD7VrRu/t9Uvx/KXHjuWfGtgNOs9YL6mgG7cNPok7 ZXrNcuDj+MoDWVVVgYMtpqaP0cN8ndTqh6aufA1iE73lNSkpvd1QHJE6ohbjU2PQbfot Lksnw+fWieClC26LioAv+WmFwJ2IVbRfk0UqzvJIn55EgEPZYb/NE8PPtd+bmCFnCfB4 ueR8TM7Ceek0+AxpxEnGGjxwHsYQ5yaUFHcvAM3YH/gfNyyu0T2dQ28Uen/BiRbT4ZAp YnIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=VAMY+QYB0IBlqZX3u93wZiWj6daygTQkkRj+m64WOSY=; b=Nv+TFn0SQYJ9/jMZ1QbbmEi8NBD4zXuPGOpyoRultq1NNS8PFv0xe1jHZxKCK/MTUm CMQxs29ssmxoBNkKfSp0k0hKIemhk8Rs53rrXqrm5qU3LTzEKz57xfs8vxuPiimD0HoH TN+jCp8JAU21AFxFcpb8KEc7ugSmD42Y/IY1uFn1almEThezQkoM90FFzG1Dox6Npigh qsKK4CehLOgug3+TrtGTRr20MD41z30mCHKgwfQ95QfCqNFGP05gVHjUEIQ2cZ5iFCmU YAx7gi1B8aFFad/fTJnx807RyWjroM/ZqaRG3/iNQpCbr8ufiWRbIeRQ+ZBNe90FWTJA 0+lA== 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 l3-v6si738575pgp.426.2018.05.15.14.35.57; Tue, 15 May 2018 14:36:13 -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 S1752236AbeEOVeK (ORCPT + 99 others); Tue, 15 May 2018 17:34:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39702 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751868AbeEOVeJ (ORCPT ); Tue, 15 May 2018 17:34:09 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.71]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 557B7C48; Tue, 15 May 2018 21:34:08 +0000 (UTC) Date: Tue, 15 May 2018 14:34:07 -0700 From: Andrew Morton To: Tetsuo Handa Cc: syzbot , syzkaller-bugs@googlegroups.com, Al Viro , dhowells@redhat.com, ernesto.mnd.fernandez@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, slava@dubeyko.com Subject: Re: [PATCH] hfsplus: stop workqueue when fill_super() failed Message-Id: <20180515143407.89e3b0e7d73c89e6071196e0@linux-foundation.org> In-Reply-To: <964a8b27-cd69-357c-fe78-76b066056201@I-love.SAKURA.ne.jp> References: <089e08e567a5b24ae90568bb75d6@google.com> <964a8b27-cd69-357c-fe78-76b066056201@I-love.SAKURA.ne.jp> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 May 2018 19:11:06 +0900 Tetsuo Handa wrote: > >From ffd64dcf946502e7bb1d23c021ee9a4fc92f9312 Mon Sep 17 00:00:00 2001 > From: Tetsuo Handa > Date: Tue, 15 May 2018 12:23:03 +0900 > Subject: [PATCH] hfsplus: stop workqueue when fill_super() failed > > syzbot is reporting ODEBUG messages at hfsplus_fill_super() [1]. > This is because hfsplus_fill_super() forgot to call > cancel_delayed_work_sync(). > > As far as I can see, it is hfsplus_mark_mdb_dirty() from > hfsplus_new_inode() in hfsplus_fill_super() that calls > queue_delayed_work(). Therefore, I assume that hfsplus_new_inode() does not > fail if queue_delayed_work() was called, and the out_put_hidden_dir label > is the appropriate location to call cancel_delayed_work_sync(). Yes, I was scratching my head over that - it is quite unobvious whereabouts in hfsplus_fill_super() that the work actually starts getting scheduled. "somewhere after the last goto out_put_root" might be true, for now. But it isn't at all obvious and it isn't very maintainable. Perhaps it's simply wrong for hfsplus to be marking things dirty and performing these complex operations partway through fill_super() before everything is fully set up. And I wouldn't be comfortable putting the cancel_work_sync() right at the end of the hfsplus_fill_super() cleanup because the delayed work handler might be using things which have already been torn down by that stage. So... ugh. A solid shotgun approach would be to put a cancel_work_sync() immediately after each and every goto target in that cleanup path, but that's just stupid :( Nasty. I can't think of anything clever here. I guess we can go with this patch for now, and if new problems crop up we can look at moving the cancel_work_sync() down to a later part of the teardown sequence.