Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6: udf: add llseek method udf: Fix error paths in udf_new_inode() udf: Fix lock inversion between iprune_mutex and alloc_mutex (v2)
This commit is contained in:
commit
e2858ce3ed
|
@ -211,6 +211,7 @@ const struct file_operations udf_file_operations = {
|
|||
.release = udf_release_file,
|
||||
.fsync = udf_fsync_file,
|
||||
.splice_read = generic_file_splice_read,
|
||||
.llseek = generic_file_llseek,
|
||||
};
|
||||
|
||||
const struct inode_operations udf_file_inode_operations = {
|
||||
|
|
|
@ -76,11 +76,24 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
|
|||
*err = -ENOSPC;
|
||||
|
||||
iinfo = UDF_I(inode);
|
||||
iinfo->i_unique = 0;
|
||||
iinfo->i_lenExtents = 0;
|
||||
iinfo->i_next_alloc_block = 0;
|
||||
iinfo->i_next_alloc_goal = 0;
|
||||
iinfo->i_strat4096 = 0;
|
||||
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) {
|
||||
iinfo->i_efe = 1;
|
||||
if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev)
|
||||
sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE;
|
||||
iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
|
||||
sizeof(struct extendedFileEntry),
|
||||
GFP_KERNEL);
|
||||
} else {
|
||||
iinfo->i_efe = 0;
|
||||
iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
|
||||
sizeof(struct fileEntry),
|
||||
GFP_KERNEL);
|
||||
}
|
||||
if (!iinfo->i_ext.i_data) {
|
||||
iput(inode);
|
||||
*err = -ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
block = udf_new_block(dir->i_sb, NULL,
|
||||
dinfo->i_location.partitionReferenceNum,
|
||||
|
@ -111,6 +124,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
|
|||
lvhd->uniqueID = cpu_to_le64(uniqueID);
|
||||
mark_buffer_dirty(sbi->s_lvid_bh);
|
||||
}
|
||||
mutex_unlock(&sbi->s_alloc_mutex);
|
||||
inode->i_mode = mode;
|
||||
inode->i_uid = current->fsuid;
|
||||
if (dir->i_mode & S_ISGID) {
|
||||
|
@ -129,25 +143,6 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
|
|||
iinfo->i_lenEAttr = 0;
|
||||
iinfo->i_lenAlloc = 0;
|
||||
iinfo->i_use = 0;
|
||||
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) {
|
||||
iinfo->i_efe = 1;
|
||||
if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev)
|
||||
sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE;
|
||||
iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
|
||||
sizeof(struct extendedFileEntry),
|
||||
GFP_KERNEL);
|
||||
} else {
|
||||
iinfo->i_efe = 0;
|
||||
iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
|
||||
sizeof(struct fileEntry),
|
||||
GFP_KERNEL);
|
||||
}
|
||||
if (!iinfo->i_ext.i_data) {
|
||||
iput(inode);
|
||||
*err = -ENOMEM;
|
||||
mutex_unlock(&sbi->s_alloc_mutex);
|
||||
return NULL;
|
||||
}
|
||||
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
|
||||
iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
|
||||
else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
|
||||
|
@ -158,7 +153,6 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
|
|||
iinfo->i_crtime = current_fs_time(inode->i_sb);
|
||||
insert_inode_hash(inode);
|
||||
mark_inode_dirty(inode);
|
||||
mutex_unlock(&sbi->s_alloc_mutex);
|
||||
|
||||
if (DQUOT_ALLOC_INODE(inode)) {
|
||||
DQUOT_DROP(inode);
|
||||
|
|
Loading…
Reference in New Issue