From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Stein Subject: UBIFS is not remounted read-only from within do_emergency_remount Date: Tue, 31 Jul 2012 13:24:19 +0200 Message-ID: <16202485.ui8ZXcNIqe@ws-stein> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit To: linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org Return-path: Received: from webbox1416.server-home.net ([77.236.96.61]:58507 "EHLO webbox1416.server-home.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755715Ab2GaLai (ORCPT ); Tue, 31 Jul 2012 07:30:38 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hello, upon testing do_emergency_remount from a power fail interrupt (using the workqueue of course), we noticed UBIFS is not remounted read-only afterwards. The current code in do_emergency_remount checks if the kernel actually needs to remount a filesystem using the following code: > if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) && > !(sb->s_flags & MS_RDONLY)) { > /* > * What lock protects sb->s_flags?? > */ > do_remount_sb(sb, MS_RDONLY, NULL, 1); > } I'm not in the details of this part of the kernel, but I suspect that sb- >s_bdev is NULL for UBIFS as it has no block device, but the character device /dev/ubiX_Y instead. I have the information from a collegue that removing the check for testing purposes for sb->s_bdev mounts UBIFS read-only. Any comments/ideas how to remount UBIFS as read-only from do_emergency_remount? Best regards, Alexander