Skip to content

Commit 957e1c4

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
ubifs: ubifs_jnl_write_inode: Only check once for the limitation of xattr count
No need to check the limitation of xattr count every time in function ubifs_jnl_write_inode(), because the 'ui->xattr_cnt' won't be modified by others in the inode evicting process. Signed-off-by: Zhihao Cheng <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 2d5404c commit 957e1c4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fs/ubifs/journal.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,12 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
981981

982982
dbg_jnl("ino %lu, nlink %u", inode->i_ino, inode->i_nlink);
983983

984+
if (kill_xattrs && ui->xattr_cnt > ubifs_xattr_max_cnt(c)) {
985+
ubifs_err(c, "Cannot delete inode, it has too much xattrs!");
986+
ubifs_ro_mode(c, err);
987+
return -EPERM;
988+
}
989+
984990
/*
985991
* If the inode is being deleted, do not write the attached data. No
986992
* need to synchronize the write-buffer either.
@@ -1012,12 +1018,6 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
10121018
struct inode *xino;
10131019
struct ubifs_dent_node *xent, *pxent = NULL;
10141020

1015-
if (ui->xattr_cnt > ubifs_xattr_max_cnt(c)) {
1016-
err = -EPERM;
1017-
ubifs_err(c, "Cannot delete inode, it has too much xattrs!");
1018-
goto out_release;
1019-
}
1020-
10211021
lowest_xent_key(c, &key, inode->i_ino);
10221022
while (1) {
10231023
xent = ubifs_tnc_next_ent(c, &key, &nm);

0 commit comments

Comments
 (0)