From patchwork Thu Apr 22 06:26:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B6rn_Engel?= X-Patchwork-Id: 50692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8A375B7D11 for ; Thu, 22 Apr 2010 16:28:19 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1O4ps8-0000bR-Rg; Thu, 22 Apr 2010 06:26:48 +0000 Received: from lazybastard.de ([212.112.238.170] helo=longford.logfs.org) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1O4ps6-0000aj-5W for linux-mtd@lists.infradead.org; Thu, 22 Apr 2010 06:26:46 +0000 Received: from joern by longford.logfs.org with local (Exim 4.63) (envelope-from ) id 1O4pru-0007DD-W5; Thu, 22 Apr 2010 08:26:35 +0200 Date: Thu, 22 Apr 2010 08:26:31 +0200 From: =?utf-8?B?SsO2cm4=?= Engel To: Linus Torvalds Subject: Re: [PATCH] [MTD] Fix JFFS2 sync silent failure Message-ID: <20100422062631.GC27309@logfs.org> References: <20100417184016.GA17345@logfs.org> <20100419073843.GN27497@kernel.dk> <20100419101559.GA4145@logfs.org> <20100419102056.GS27497@kernel.dk> <20100422055448.GA27309@logfs.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100422055448.GA27309@logfs.org> User-Agent: Mutt/1.5.13 (2006-08-11) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100422_022646_462012_255DC3A6 X-CRM114-Status: GOOD ( 11.66 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- Cc: Christoph Hellwig , linux-mtd@lists.infradead.org, David Woodhouse , linux-kernel@vger.kernel.org, Jens Axboe X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Linus, I think this is bad enough that you should be involved. 32a88aa1 broke a number of filesystems in a way that sync() would return 0 without doing any work. Even politicians are better at keeping the promises. This is caused by the two-liner in __sync_filesystem: if (!sb->s_bdi) return 0; s_bdi is set implicitly for all filesystems using set_bdev_super(), so most block device based filesystems are safe. There are, however, a number of odd-balls around: On Thu, 22 April 2010 07:54:48 +0200, Jörn Engel wrote: > > 9p no s_bdi > afs no s_bdi > ceph creates its own s_bdi > cifs no s_bdi > coda no s_bdi > ecryptfs no s_bdi > exofs no s_bdi > fuse creates its own s_bdi? > gfs2 creates its own s_bdi? > jffs2 patch exists > logfs fixed now > ncpfs no s_bdi > nfs creates its own s_bdi > ocfs2 no s_bdi > smbfs no s_bdi > ubifs creates its own s_bdi Obviously this list should get checked and all affected filesystems get repaired. Additionally we should add an assertion and BUG() or refuse to mount or something. My original patch to that extend was this: goto out_sb; The real problem is finding a condition that has neither false positives nor false negatives. The "(mnt->mnt_sb->s_bdev || mnt->mnt_sb->s_mtd)" part takes care of false positives like tmpfs, but it would catch none of the network filesystems. Should we instead annotate tmpfs and friends with something like sb->s_dont_need_bdi? It is the only way I can think of not to miss something. Jörn diff --git a/fs/super.c b/fs/super.c index f35ac60..e8af253 100644 --- a/fs/super.c +++ b/fs/super.c @@ -954,6 +954,8 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void if (error < 0) goto out_free_secdata; BUG_ON(!mnt->mnt_sb); + BUG_ON(!mnt->mnt_sb->s_bdi && + (mnt->mnt_sb->s_bdev || mnt->mnt_sb->s_mtd)); error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata); if (error)