Skip to content

Commit 819f9ab

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
ubifs: Remove ui_mutex in ubifs_xattr_get and change_xattr
Since ubifs_xattr_get and ubifs_xattr_set cannot being executed parallelly after importing @host_ui->xattr_sem, now we can remove ui_mutex imported by commit ab92a20 ("ubifs: make ubifs_[get|set]xattr atomic"). @xattr_size, @xattr_names and @xattr_cnt can't be out of protection by @host_ui->mutex yet, they are sill accesed in other places, such as pack_inode() called by ubifs_write_inode() triggered by page-writeback. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent f4e3634 commit 819f9ab

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

fs/ubifs/xattr.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,11 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
208208
err = -ENOMEM;
209209
goto out_free;
210210
}
211-
mutex_lock(&ui->ui_mutex);
212211
kfree(ui->data);
213212
ui->data = buf;
214213
inode->i_size = ui->ui_size = size;
215214
old_size = ui->data_len;
216215
ui->data_len = size;
217-
mutex_unlock(&ui->ui_mutex);
218216

219217
mutex_lock(&host_ui->ui_mutex);
220218
host->i_ctime = current_time(host);
@@ -362,7 +360,6 @@ ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
362360
ubifs_assert(c, inode->i_size == ui->data_len);
363361
ubifs_assert(c, ubifs_inode(host)->xattr_size > ui->data_len);
364362

365-
mutex_lock(&ui->ui_mutex);
366363
if (buf) {
367364
/* If @buf is %NULL we are supposed to return the length */
368365
if (ui->data_len > size) {
@@ -375,7 +372,6 @@ ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
375372
err = ui->data_len;
376373

377374
out_iput:
378-
mutex_unlock(&ui->ui_mutex);
379375
iput(inode);
380376
out_cleanup:
381377
up_read(&ubifs_inode(host)->xattr_sem);

0 commit comments

Comments
 (0)