Skip to content

Commit

Permalink
Merge tag 'fs_for_v6.13-rc2' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/jack/linux-fs

Pull quota and udf fixes from Jan Kara:
 "Two small UDF fixes for better handling of corrupted filesystem and a
  quota fix to fix handling of filesystem freezing"

* tag 'fs_for_v6.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  udf: Verify inode link counts before performing rename
  udf: Skip parent dir link count update if corrupted
  quota: flush quota_release_work upon quota writeback
  • Loading branch information
Linus Torvalds committed Dec 3, 2024
2 parents 9141c5d + 6756af9 commit 3d24694
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@ int dquot_writeback_dquots(struct super_block *sb, int type)

WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount));

flush_delayed_work(&quota_release_work);

for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
if (type != -1 && cnt != type)
continue;
Expand Down
16 changes: 15 additions & 1 deletion fs/udf/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,11 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
inode->i_nlink);
clear_nlink(inode);
inode->i_size = 0;
inode_dec_link_count(dir);
if (dir->i_nlink >= 3)
inode_dec_link_count(dir);
else
udf_warn(inode->i_sb, "parent dir link count too low (%u)\n",
dir->i_nlink);
udf_add_fid_counter(dir->i_sb, true, -1);
inode_set_mtime_to_ts(dir,
inode_set_ctime_to_ts(dir, inode_set_ctime_current(inode)));
Expand Down Expand Up @@ -787,8 +791,18 @@ static int udf_rename(struct mnt_idmap *idmap, struct inode *old_dir,
retval = -ENOTEMPTY;
if (!empty_dir(new_inode))
goto out_oiter;
retval = -EFSCORRUPTED;
if (new_inode->i_nlink != 2)
goto out_oiter;
}
retval = -EFSCORRUPTED;
if (old_dir->i_nlink < 3)
goto out_oiter;
is_dir = true;
} else if (new_inode) {
retval = -EFSCORRUPTED;
if (new_inode->i_nlink < 1)
goto out_oiter;
}
if (is_dir && old_dir != new_dir) {
retval = udf_fiiter_find_entry(old_inode, &dotdot_name,
Expand Down

0 comments on commit 3d24694

Please sign in to comment.