mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] ubifs: Fixes for xattr concurrent operations
@ 2021-05-31 12:52 Zhihao Cheng
  2021-05-31 12:52 ` [PATCH 1/2] ubifs: Fix races between xattr_{set|get} and listxattr operations Zhihao Cheng
  2021-05-31 12:52 ` [PATCH 2/2] ubifs: Remove ui_mutex in ubifs_xattr_get and change_xattr Zhihao Cheng
  0 siblings, 2 replies; 4+ messages in thread
From: Zhihao Cheng @ 2021-05-31 12:52 UTC (permalink / raw)
  To: richard, yangds.fnst, s.hauer
  Cc: yi.zhang, houtao1, yukuai3, chengzhihao1, linux-mtd, linux-kernel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-16  8:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31 12:52 [PATCH 0/2] ubifs: Fixes for xattr concurrent operations Zhihao Cheng
2021-05-31 12:52 ` [PATCH 1/2] ubifs: Fix races between xattr_{set|get} and listxattr operations Zhihao Cheng
2021-06-16  8:23   ` Sascha Hauer
2021-05-31 12:52 ` [PATCH 2/2] ubifs: Remove ui_mutex in ubifs_xattr_get and change_xattr Zhihao Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®