From: Jan Kara <jack@xxxxxxx> [ Upstream commit dbfb102d16fb780c84f41adbaeb7eac907c415dc ] Convert udf_link() to use new directory iteration code for adding entry into the directory. Signed-off-by: Jan Kara <jack@xxxxxxx> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/udf/namei.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -1222,27 +1222,21 @@ static int udf_link(struct dentry *old_d struct dentry *dentry) { struct inode *inode = d_inode(old_dentry); - struct udf_fileident_bh fibh; - struct fileIdentDesc cfi, *fi; + struct udf_fileident_iter iter; int err; - fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); - if (!fi) { + err = udf_fiiter_add_entry(dir, dentry, &iter); + if (err) return err; - } - cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); - cfi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location); + iter.fi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); + iter.fi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location); if (UDF_SB(inode->i_sb)->s_lvid_bh) { - *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = + *(__le32 *)((struct allocDescImpUse *)iter.fi.icb.impUse)->impUse = cpu_to_le32(lvid_get_unique_id(inode->i_sb)); } - udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); - if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) - mark_inode_dirty(dir); + udf_fiiter_write_fi(&iter, NULL); + udf_fiiter_release(&iter); - if (fibh.sbh != fibh.ebh) - brelse(fibh.ebh); - brelse(fibh.sbh); inc_nlink(inode); inode->i_ctime = current_time(inode); mark_inode_dirty(inode); Patches currently in stable-queue which might be from cascardo@xxxxxxxxxx are queue-6.1/udf-handle-error-when-expanding-directory.patch queue-6.1/udf-convert-empty_dir-to-new-directory-iteration-code.patch queue-6.1/udf-convert-udf_expand_dir_adinicb-to-new-directory-iteration.patch queue-6.1/udf-convert-udf_unlink-to-new-directory-iteration-code.patch queue-6.1/udf-convert-udf_add_nondir-to-new-directory-iteration.patch queue-6.1/udf-convert-udf_link-to-new-directory-iteration-code.patch queue-6.1/udf-remove-old-directory-iteration-code.patch queue-6.1/udf-don-t-return-bh-from-udf_expand_dir_adinicb.patch queue-6.1/udf-new-directory-iteration-code.patch queue-6.1/udf-convert-udf_rmdir-to-new-directory-iteration-code.patch queue-6.1/udf-move-udf_expand_dir_adinicb-to-its-callsite.patch queue-6.1/udf-convert-udf_readdir-to-new-directory-iteration.patch queue-6.1/udf-convert-udf_mkdir-to-new-directory-iteration-code.patch queue-6.1/udf-provide-function-to-mark-entry-as-deleted-using-new-directory-iteration-code.patch queue-6.1/udf-convert-udf_lookup-to-use-new-directory-iteration-code.patch queue-6.1/udf-implement-adding-of-dir-entries-using-new-iteration-code.patch queue-6.1/udf-convert-udf_rename-to-new-directory-iteration-code.patch queue-6.1/udf-convert-udf_get_parent-to-new-directory-iteration-code.patch queue-6.1/udf-implement-searching-for-directory-entry-using-new-iteration-code.patch