[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210531125210.1173922-1-chengzhihao1@huawei.com>
Date: Mon, 31 May 2021 20:52:08 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: <richard@....at>, <yangds.fnst@...fujitsu.com>,
<s.hauer@...gutronix.de>
CC: <yi.zhang@...wei.com>, <houtao1@...wei.com>, <yukuai3@...wei.com>,
<chengzhihao1@...wei.com>, <linux-mtd@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH 0/2] ubifs: Fixes for xattr concurrent operations
UBIFS may occur some problems with concurrent xattr_{set|get} and
listxattr operations, such as assertion failure, memory corruption,
stale xattr value[1].
Patch 1: Import a new rw-lock in @ubifs_inode to serilize write
operations on xattr
Patch 2: Remove unnecessary ui_mutex in ubifs_xattr_get and change_xattr
BTW changing @host->ui_mutex to a rw lock to adapting xattr operations
is a risky method, since @host->ui_mutex acts as too many roles:
* serializes inode write-back with the rest of VFS operations(such as
rename, mkdir, rmdir, create, eg.)
* serializes "clean <-> dirty" state changes, serializes bulk-read
* protects @dirty, @bulk_read, @ui_size, and @xattr_size
Besides, if xattr operations and io/vfs operations share same rw-lock,
xattr operations may effect UBIFS performance more or less.
[1] https://lore.kernel.org/linux-mtd/20200630130438.141649-1-houtao1@huawei.com
Zhihao Cheng (2):
ubifs: Fix races between xattr_{set|get} and listxattr operations
ubifs: Remove ui_mutex in ubifs_xattr_get and change_xattr
fs/ubifs/super.c | 1 +
fs/ubifs/ubifs.h | 2 ++
fs/ubifs/xattr.c | 48 +++++++++++++++++++++++++++++++++---------------
3 files changed, 36 insertions(+), 15 deletions(-)
--
2.25.4
Powered by blists - more mailing lists