Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>

authored by

Zhihao Cheng and committed by
Richard Weinberger
957e1c4e 2d5404ca

+6 -6
+6 -6
fs/ubifs/journal.c
··· 981 981 982 982 dbg_jnl("ino %lu, nlink %u", inode->i_ino, inode->i_nlink); 983 983 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 + 984 990 /* 985 991 * If the inode is being deleted, do not write the attached data. No 986 992 * need to synchronize the write-buffer either. ··· 1017 1011 struct fscrypt_name nm = {0}; 1018 1012 struct inode *xino; 1019 1013 struct ubifs_dent_node *xent, *pxent = NULL; 1020 - 1021 - if (ui->xattr_cnt > ubifs_xattr_max_cnt(c)) { 1022 - err = -EPERM; 1023 - ubifs_err(c, "Cannot delete inode, it has too much xattrs!"); 1024 - goto out_release; 1025 - } 1026 1014 1027 1015 lowest_xent_key(c, &key, inode->i_ino); 1028 1016 while (1) {