From patchwork Sun Jan 21 17:53:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 864079 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C2D9Lxd9"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zPhz76Qhdz9s7F for ; Mon, 22 Jan 2018 04:54:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GYjlXwecP6zS3+44+k5b4/Epe8X9XPU/N+4/Bv+drWM=; b=C2D9Lxd90rtoFq N95jriMS0JT6W7YQWYKTrvTjSs0nIycSmS5SAxHiL68x9eiDBjmfsBEtpHlarhxoeN1okHMmKsYOc ytu4Fwq/hssNIw+lS+hpfe6x86HR/kps++RrxjN/12NQPhn7wfzlyTezjrlwBVkJPNuoSyF26S8Mr GTqgBZIP6Ofs2BcxFS6J64b03ZAr/SvtyvdtVTlxakWjvCnqOoLo0Ww8nTcK4wkt95KCWCHfg8S7S Z+e68LClmA1EV867W3YoXD6wwzhRl8GoLxKn/j2JaoDyVstyo3kXHPHEbhfip+8PtfV5kIUMJtjfp xIYaa+ExNdIlfoHdK3+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1edJpI-0005ty-Mm; Sun, 21 Jan 2018 17:54:40 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1edJoa-0004VU-Qt for lede-dev@lists.infradead.org; Sun, 21 Jan 2018 17:54:02 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id B512B42C2B; Sun, 21 Jan 2018 18:53:43 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id CApzmGC03jg9; Sun, 21 Jan 2018 18:53:33 +0100 (CET) From: Hauke Mehrtens To: lede-dev@lists.infradead.org, kaloz@openwrt.org Date: Sun, 21 Jan 2018 18:53:04 +0100 Message-Id: <20180121175308.15585-2-hauke@hauke-m.de> In-Reply-To: <20180121175308.15585-1-hauke@hauke-m.de> References: <20180121175308.15585-1-hauke@hauke-m.de> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [80.241.60.212 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH v2 1/5] kernel: ubifs: create use file system format 4 by default X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hauke Mehrtens , tomek_n@o2.pl, luci@createc.ro MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Instead of creating an ubifs file system with format version 5 by default on empty UBI volumes use the older format 4 by default. This will make it possible to mount these file systems also on older kernel versions. When a user wants to do a sysupgrade from kernel 4.14 to kernel 4.9 the old kernel has to read the file system created by the more recent kernel which currently does not work for ubifs. This fixes the problem by creating file systems which are compatible with older kernel versions by default. Kernel 4.14 will still be able to read and write UBI FS file system version 5, it will just not be used when a ubifs partition is created implicitly on an empty UBI volume. Signed-off-by: Hauke Mehrtens --- target/linux/generic/config-4.14 | 1 + ...ption-to-create-UBI-FS-version-4-on-empty.patch | 63 ++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 target/linux/generic/pending-4.14/553-ubifs-Add-option-to-create-UBI-FS-version-4-on-empty.patch diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index fa389bf8c0..39c37744c9 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -4974,6 +4974,7 @@ CONFIG_TTY=y # CONFIG_UACCESS_WITH_MEMCPY is not set # CONFIG_UBIFS_ATIME_SUPPORT is not set # CONFIG_UBIFS_FS_ENCRYPTION is not set +CONFIG_UBIFS_FS_FORMAT4=y # CONFIG_UBIFS_FS_SECURITY is not set # CONFIG_UBSAN is not set # CONFIG_UCB1400_CORE is not set diff --git a/target/linux/generic/pending-4.14/553-ubifs-Add-option-to-create-UBI-FS-version-4-on-empty.patch b/target/linux/generic/pending-4.14/553-ubifs-Add-option-to-create-UBI-FS-version-4-on-empty.patch new file mode 100644 index 0000000000..4b413996f2 --- /dev/null +++ b/target/linux/generic/pending-4.14/553-ubifs-Add-option-to-create-UBI-FS-version-4-on-empty.patch @@ -0,0 +1,63 @@ +From 93c33e6a7f3b0aef99d02252e6232a3d8b80f2d5 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 21 Jan 2018 15:47:50 +0100 +Subject: ubifs: Add option to create UBI FS version 4 on empty UBI volume + +Instead of creating an ubifs file system with format version 5 by +default on empty UBI volumes add a compile option to create an older ubi +with file system format version 4 instated. This allows it to be mount +as a volume on kernel versions < 4.10, which does not support format +version 5. +We saw that some people can not access their older data when they +downgraded from kernel 4.14 to kernel 4.9 to prevent this this option +would help. + +Signed-off-by: Hauke Mehrtens +--- + fs/ubifs/Kconfig | 13 +++++++++++++ + fs/ubifs/sb.c | 6 ++++++ + 2 files changed, 19 insertions(+) + +--- a/fs/ubifs/Kconfig ++++ b/fs/ubifs/Kconfig +@@ -74,3 +74,16 @@ config UBIFS_FS_SECURITY + the extended attribute support in advance. + + If you are not using a security module, say N. ++ ++config UBIFS_FS_FORMAT4 ++ bool "Use file system format version 4 for new file systems" ++ depends on UBIFS_FS ++ help ++ Instead of creating new file systems with the new ubifs file ++ system version 5, use the old format version 4 for implicitly ++ by the driver created file systems on an empty UBI volume. This ++ makes it possible to mount these file systems also with kernel ++ versions before 4.10. The driver will still support file system ++ format version 5 for ubifs file systems created with version 5. ++ ++ If you are unsure, say N. +--- a/fs/ubifs/sb.c ++++ b/fs/ubifs/sb.c +@@ -176,7 +176,9 @@ static int create_default_filesystem(str + tmp64 = (long long)max_buds * c->leb_size; + if (big_lpt) + sup_flags |= UBIFS_FLG_BIGLPT; ++#ifndef CONFIG_UBIFS_FS_FORMAT4 + sup_flags |= UBIFS_FLG_DOUBLE_HASH; ++#endif + + sup->ch.node_type = UBIFS_SB_NODE; + sup->key_hash = UBIFS_KEY_HASH_R5; +@@ -192,7 +194,11 @@ static int create_default_filesystem(str + sup->jhead_cnt = cpu_to_le32(DEFAULT_JHEADS_CNT); + sup->fanout = cpu_to_le32(DEFAULT_FANOUT); + sup->lsave_cnt = cpu_to_le32(c->lsave_cnt); ++#ifdef CONFIG_UBIFS_FS_FORMAT4 ++ sup->fmt_version = cpu_to_le32(4); ++#else + sup->fmt_version = cpu_to_le32(UBIFS_FORMAT_VERSION); ++#endif + sup->time_gran = cpu_to_le32(DEFAULT_TIME_GRAN); + if (c->mount_opts.override_compr) + sup->default_compr = cpu_to_le16(c->mount_opts.compr_type);