Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

f2fs: declare nested quota_sem and remove unnecessary sems

1.
f2fs_quota_sync
-> down_read(&sbi->quota_sem)
-> dquot_writeback_dquots
-> f2fs_dquot_commit
-> down_read(&sbi->quota_sem)

2.
f2fs_quota_sync
-> down_read(&sbi->quota_sem)
-> f2fs_write_data_pages
-> f2fs_write_single_data_page
-> down_write(&F2FS_I(inode)->i_sem)

f2fs_mkdir
-> f2fs_do_add_link
-> down_write(&F2FS_I(inode)->i_sem)
-> f2fs_init_inode_metadata
-> f2fs_new_node_page
-> dquot_alloc_inode
-> f2fs_dquot_mark_dquot_dirty
-> down_read(&sbi->quota_sem)

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

+4 -14
+4 -14
fs/f2fs/super.c
··· 2158 2158 struct f2fs_sb_info *sbi = F2FS_SB(dquot->dq_sb); 2159 2159 int ret; 2160 2160 2161 - down_read(&sbi->quota_sem); 2161 + down_read_nested(&sbi->quota_sem, SINGLE_DEPTH_NESTING); 2162 2162 ret = dquot_commit(dquot); 2163 2163 if (ret < 0) 2164 2164 set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); ··· 2182 2182 static int f2fs_dquot_release(struct dquot *dquot) 2183 2183 { 2184 2184 struct f2fs_sb_info *sbi = F2FS_SB(dquot->dq_sb); 2185 - int ret; 2185 + int ret = dquot_release(dquot); 2186 2186 2187 - down_read(&sbi->quota_sem); 2188 - ret = dquot_release(dquot); 2189 2187 if (ret < 0) 2190 2188 set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); 2191 - up_read(&sbi->quota_sem); 2192 2189 return ret; 2193 2190 } 2194 2191 ··· 2193 2196 { 2194 2197 struct super_block *sb = dquot->dq_sb; 2195 2198 struct f2fs_sb_info *sbi = F2FS_SB(sb); 2196 - int ret; 2197 - 2198 - down_read(&sbi->quota_sem); 2199 - ret = dquot_mark_dquot_dirty(dquot); 2199 + int ret = dquot_mark_dquot_dirty(dquot); 2200 2200 2201 2201 /* if we are using journalled quota */ 2202 2202 if (is_journalled_quota(sbi)) 2203 2203 set_sbi_flag(sbi, SBI_QUOTA_NEED_FLUSH); 2204 2204 2205 - up_read(&sbi->quota_sem); 2206 2205 return ret; 2207 2206 } 2208 2207 2209 2208 static int f2fs_dquot_commit_info(struct super_block *sb, int type) 2210 2209 { 2211 2210 struct f2fs_sb_info *sbi = F2FS_SB(sb); 2212 - int ret; 2211 + int ret = dquot_commit_info(sb, type); 2213 2212 2214 - down_read(&sbi->quota_sem); 2215 - ret = dquot_commit_info(sb, type); 2216 2213 if (ret < 0) 2217 2214 set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); 2218 - up_read(&sbi->quota_sem); 2219 2215 return ret; 2220 2216 } 2221 2217