summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/ifile.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-08-11 19:06:10 +0200
committerJan Kara <jack@suse.cz>2009-09-16 17:44:11 +0200
commit00171d3c7e3b738ba582c7a9b37408e796f49046 (patch)
tree4c43c59666d78ccb1522a99dd7966252d5878ccf /fs/nilfs2/ifile.c
parent3adae9da0b35d2ca908039f42a1e90395c335181 (diff)
downloadop-kernel-dev-00171d3c7e3b738ba582c7a9b37408e796f49046.zip
op-kernel-dev-00171d3c7e3b738ba582c7a9b37408e796f49046.tar.gz
ext3: Fix possible deadlock between ext3_truncate() and ext3_get_blocks()
During truncate we are sometimes forced to start a new transaction as the amount of blocks to be journaled is both quite large and hard to predict. So far we restarted a transaction while holding truncate_mutex and that violates lock ordering because truncate_mutex ranks below transaction start (and it can lead to a real deadlock with ext3_get_blocks() allocating new blocks from ext3_writepage()). Luckily, the problem is easy to fix: We just drop the truncate_mutex before restarting the transaction and acquire it afterwards. We are safe to do this as by the time ext3_truncate() is called, all the page cache for the truncated part of the file is dropped and so writepage() cannot come and allocate new blocks in the part of the file we are truncating. The rest of writers is stopped by us holding i_mutex. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/nilfs2/ifile.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud