aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/mdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/mdt.c')
-rw-r--r--fs/nilfs2/mdt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index 2dfd47714ae5..a5cd80162dc5 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -402,6 +402,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
402 struct inode *inode = container_of(page->mapping, 402 struct inode *inode = container_of(page->mapping,
403 struct inode, i_data); 403 struct inode, i_data);
404 struct super_block *sb = inode->i_sb; 404 struct super_block *sb = inode->i_sb;
405 struct the_nilfs *nilfs = NILFS_MDT(inode)->mi_nilfs;
405 struct nilfs_sb_info *writer = NULL; 406 struct nilfs_sb_info *writer = NULL;
406 int err = 0; 407 int err = 0;
407 408
@@ -411,9 +412,10 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
411 if (page->mapping->assoc_mapping) 412 if (page->mapping->assoc_mapping)
412 return 0; /* Do not request flush for shadow page cache */ 413 return 0; /* Do not request flush for shadow page cache */
413 if (!sb) { 414 if (!sb) {
414 writer = nilfs_get_writer(NILFS_MDT(inode)->mi_nilfs); 415 down_read(&nilfs->ns_writer_sem);
416 writer = nilfs->ns_writer;
415 if (!writer) { 417 if (!writer) {
416 nilfs_put_writer(NILFS_MDT(inode)->mi_nilfs); 418 up_read(&nilfs->ns_writer_sem);
417 return -EROFS; 419 return -EROFS;
418 } 420 }
419 sb = writer->s_super; 421 sb = writer->s_super;
@@ -425,7 +427,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
425 nilfs_flush_segment(sb, inode->i_ino); 427 nilfs_flush_segment(sb, inode->i_ino);
426 428
427 if (writer) 429 if (writer)
428 nilfs_put_writer(NILFS_MDT(inode)->mi_nilfs); 430 up_read(&nilfs->ns_writer_sem);
429 return err; 431 return err;
430} 432}
431 433