.. | .. |
---|
426 | 426 | mutex_unlock(&dir_ui->ui_mutex); |
---|
427 | 427 | |
---|
428 | 428 | ubifs_release_budget(c, &req); |
---|
| 429 | + fscrypt_free_filename(&nm); |
---|
429 | 430 | |
---|
430 | 431 | return 0; |
---|
431 | 432 | |
---|
.. | .. |
---|
1118 | 1119 | int err, sz_change, len = strlen(symname); |
---|
1119 | 1120 | struct fscrypt_str disk_link; |
---|
1120 | 1121 | struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1, |
---|
1121 | | - .new_ino_d = ALIGN(len, 8), |
---|
1122 | 1122 | .dirtied_ino = 1 }; |
---|
1123 | 1123 | struct fscrypt_name nm; |
---|
1124 | 1124 | |
---|
.. | .. |
---|
1134 | 1134 | * Budget request settings: new inode, new direntry and changing parent |
---|
1135 | 1135 | * directory inode. |
---|
1136 | 1136 | */ |
---|
| 1137 | + req.new_ino_d = ALIGN(disk_link.len - 1, 8); |
---|
1137 | 1138 | err = ubifs_budget_space(c, &req); |
---|
1138 | 1139 | if (err) |
---|
1139 | 1140 | return err; |
---|
.. | .. |
---|
1289 | 1290 | if (unlink) { |
---|
1290 | 1291 | ubifs_assert(c, inode_is_locked(new_inode)); |
---|
1291 | 1292 | |
---|
| 1293 | + /* Budget for old inode's data when its nlink > 1. */ |
---|
| 1294 | + req.dirtied_ino_d = ALIGN(ubifs_inode(new_inode)->data_len, 8); |
---|
1292 | 1295 | err = ubifs_purge_xattrs(new_inode); |
---|
1293 | 1296 | if (err) |
---|
1294 | 1297 | return err; |
---|
.. | .. |
---|
1531 | 1534 | return err; |
---|
1532 | 1535 | } |
---|
1533 | 1536 | |
---|
| 1537 | + err = ubifs_budget_space(c, &req); |
---|
| 1538 | + if (err) |
---|
| 1539 | + goto out; |
---|
| 1540 | + |
---|
1534 | 1541 | lock_4_inodes(old_dir, new_dir, NULL, NULL); |
---|
1535 | 1542 | |
---|
1536 | 1543 | time = current_time(old_dir); |
---|
.. | .. |
---|
1556 | 1563 | unlock_4_inodes(old_dir, new_dir, NULL, NULL); |
---|
1557 | 1564 | ubifs_release_budget(c, &req); |
---|
1558 | 1565 | |
---|
| 1566 | +out: |
---|
1559 | 1567 | fscrypt_free_filename(&fst_nm); |
---|
1560 | 1568 | fscrypt_free_filename(&snd_nm); |
---|
1561 | 1569 | return err; |
---|