@@ -86,7 +86,9 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
8686
8787 jfs_info ("jfs_create: dip:0x%p name:%pd" , dip , dentry );
8888
89- dquot_initialize (dip );
89+ rc = dquot_initialize (dip );
90+ if (rc )
91+ goto out1 ;
9092
9193 /*
9294 * search parent directory for entry/freespace
@@ -218,7 +220,9 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
218220
219221 jfs_info ("jfs_mkdir: dip:0x%p name:%pd" , dip , dentry );
220222
221- dquot_initialize (dip );
223+ rc = dquot_initialize (dip );
224+ if (rc )
225+ goto out1 ;
222226
223227 /*
224228 * search parent directory for entry/freespace
@@ -355,8 +359,12 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
355359 jfs_info ("jfs_rmdir: dip:0x%p name:%pd" , dip , dentry );
356360
357361 /* Init inode for quota operations. */
358- dquot_initialize (dip );
359- dquot_initialize (ip );
362+ rc = dquot_initialize (dip );
363+ if (rc )
364+ goto out ;
365+ rc = dquot_initialize (ip );
366+ if (rc )
367+ goto out ;
360368
361369 /* directory must be empty to be removed */
362370 if (!dtEmpty (ip )) {
@@ -483,8 +491,12 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
483491 jfs_info ("jfs_unlink: dip:0x%p name:%pd" , dip , dentry );
484492
485493 /* Init inode for quota operations. */
486- dquot_initialize (dip );
487- dquot_initialize (ip );
494+ rc = dquot_initialize (dip );
495+ if (rc )
496+ goto out ;
497+ rc = dquot_initialize (ip );
498+ if (rc )
499+ goto out ;
488500
489501 if ((rc = get_UCSname (& dname , dentry )))
490502 goto out ;
@@ -799,7 +811,9 @@ static int jfs_link(struct dentry *old_dentry,
799811
800812 jfs_info ("jfs_link: %pd %pd" , old_dentry , dentry );
801813
802- dquot_initialize (dir );
814+ rc = dquot_initialize (dir );
815+ if (rc )
816+ goto out ;
803817
804818 tid = txBegin (ip -> i_sb , 0 );
805819
@@ -810,7 +824,7 @@ static int jfs_link(struct dentry *old_dentry,
810824 * scan parent directory for entry/freespace
811825 */
812826 if ((rc = get_UCSname (& dname , dentry )))
813- goto out ;
827+ goto out_tx ;
814828
815829 if ((rc = dtSearch (dir , & dname , & ino , & btstack , JFS_CREATE )))
816830 goto free_dname ;
@@ -842,12 +856,13 @@ static int jfs_link(struct dentry *old_dentry,
842856 free_dname :
843857 free_UCSname (& dname );
844858
845- out :
859+ out_tx :
846860 txEnd (tid );
847861
848862 mutex_unlock (& JFS_IP (ip )-> commit_mutex );
849863 mutex_unlock (& JFS_IP (dir )-> commit_mutex );
850864
865+ out :
851866 jfs_info ("jfs_link: rc:%d" , rc );
852867 return rc ;
853868}
@@ -891,7 +906,9 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
891906
892907 jfs_info ("jfs_symlink: dip:0x%p name:%s" , dip , name );
893908
894- dquot_initialize (dip );
909+ rc = dquot_initialize (dip );
910+ if (rc )
911+ goto out1 ;
895912
896913 ssize = strlen (name ) + 1 ;
897914
@@ -1082,8 +1099,12 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
10821099
10831100 jfs_info ("jfs_rename: %pd %pd" , old_dentry , new_dentry );
10841101
1085- dquot_initialize (old_dir );
1086- dquot_initialize (new_dir );
1102+ rc = dquot_initialize (old_dir );
1103+ if (rc )
1104+ goto out1 ;
1105+ rc = dquot_initialize (new_dir );
1106+ if (rc )
1107+ goto out1 ;
10871108
10881109 old_ip = d_inode (old_dentry );
10891110 new_ip = d_inode (new_dentry );
@@ -1130,7 +1151,9 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
11301151 } else if (new_ip ) {
11311152 IWRITE_LOCK (new_ip , RDWRLOCK_NORMAL );
11321153 /* Init inode for quota operations. */
1133- dquot_initialize (new_ip );
1154+ rc = dquot_initialize (new_ip );
1155+ if (rc )
1156+ goto out_unlock ;
11341157 }
11351158
11361159 /*
@@ -1318,6 +1341,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
13181341
13191342 clear_cflag (COMMIT_Stale , old_dir );
13201343 }
1344+ out_unlock :
13211345 if (new_ip && !S_ISDIR (new_ip -> i_mode ))
13221346 IWRITE_UNLOCK (new_ip );
13231347 out3 :
@@ -1353,7 +1377,9 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
13531377
13541378 jfs_info ("jfs_mknod: %pd" , dentry );
13551379
1356- dquot_initialize (dir );
1380+ rc = dquot_initialize (dir );
1381+ if (rc )
1382+ goto out ;
13571383
13581384 if ((rc = get_UCSname (& dname , dentry )))
13591385 goto out ;
0 commit comments