[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230803023128.35170-1-zhanchengbin1@huawei.com>
Date: Thu, 3 Aug 2023 10:31:26 +0800
From: zhanchengbin <zhanchengbin1@...wei.com>
To: <tytso@....edu>
CC: <linux-ext4@...r.kernel.org>, <louhongxiang@...wei.com>,
<linfeilong@...wei.com>, <yi.zhang@...wei.com>,
<yebin10@...wei.com>, <liuzhiqiang26@...wei.com>,
zhanchengbin <zhanchengbin1@...wei.com>
Subject: [RFC PATCH v2 0/2] ext4: Fix the conflict between modifying the superblock in user mode and kernel mode
Tune2fs does not recognize writes to filesystems in another namespace. Two
simultaneous write operations on a block will lead to file system
inconsistency, because there is no lock protection between userland and
kernelland.
The operation is as follows:
first terminal second terminal
mkfs.ext4 /dev/sdb;
mount /dev/sdb /test-sdb;
dd if=/dev/zero of=/test-sdb/test1 bs=1M count=100;
unshare -m;
umount;
gdb tune2fs;
b io_channel_write_byte
r -e remount-ro /dev/sdb
c(Write a byte of old data into the cache)
exit;
(gdb finish)
tune2fs -l /dev/sdb;
tune2fs 1.46.4 (18-Aug-2021)
tune2fs: Superblock checksum does not match superblock while trying to
open /dev/sdb
Couldn't find valid filesystem superblock.
Link: https://lore.kernel.org/linux-ext4/29f6134f-ba0a-d601-0a5a-ad2b5e9bbf1d@huawei.com/
After discussing with Tytso, I decided to use ioctl to solve the above
problems. These patches are an example I wrote to complete the modification
of the s_errors variable in the super block.
Finally, if you have any good ideas, welcome to communicate with me by
email.
Diff V2 vs V1:
1) Modify symbols of comment.
Link: https://lore.kernel.org/oe-kbuild-all/202308030412.jMcaYq0E-lkp@intel.com/
2) Add static symbols to functions.
Link: https://lore.kernel.org/oe-kbuild-all/202308021801.ieUVR2xl-lkp@intel.com/
zhanchengbin (2):
ext4: ioctl adds a framework for modifying superblock parameters
ext4: ioctl add EXT4_IOC_SUPERBLOCK_KEY_S_ERRORS
fs/ext4/ext4.h | 12 +++
fs/ext4/ioctl.c | 149 ++++++++++++++++++++++++++++++++++++++
include/uapi/linux/ext4.h | 28 +++++++
3 files changed, 189 insertions(+)
--
2.31.1
Powered by blists - more mailing lists