diff options
Diffstat (limited to 'fs/nilfs2')
| -rw-r--r-- | fs/nilfs2/btnode.c | 4 | ||||
| -rw-r--r-- | fs/nilfs2/cpfile.c | 2 | ||||
| -rw-r--r-- | fs/nilfs2/inode.c | 1 | ||||
| -rw-r--r-- | fs/nilfs2/ioctl.c | 39 | ||||
| -rw-r--r-- | fs/nilfs2/segment.c | 17 |
5 files changed, 33 insertions, 30 deletions
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c index 5941958f1e47..84c25382f8e3 100644 --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c | |||
| @@ -87,6 +87,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr, | |||
| 87 | brelse(bh); | 87 | brelse(bh); |
| 88 | BUG(); | 88 | BUG(); |
| 89 | } | 89 | } |
| 90 | memset(bh->b_data, 0, 1 << inode->i_blkbits); | ||
| 90 | bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev; | 91 | bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev; |
| 91 | bh->b_blocknr = blocknr; | 92 | bh->b_blocknr = blocknr; |
| 92 | set_buffer_mapped(bh); | 93 | set_buffer_mapped(bh); |
| @@ -276,8 +277,7 @@ void nilfs_btnode_commit_change_key(struct address_space *btnc, | |||
| 276 | "invalid oldkey %lld (newkey=%lld)", | 277 | "invalid oldkey %lld (newkey=%lld)", |
| 277 | (unsigned long long)oldkey, | 278 | (unsigned long long)oldkey, |
| 278 | (unsigned long long)newkey); | 279 | (unsigned long long)newkey); |
| 279 | if (!test_set_buffer_dirty(obh) && TestSetPageDirty(opage)) | 280 | nilfs_btnode_mark_dirty(obh); |
| 280 | BUG(); | ||
| 281 | 281 | ||
| 282 | spin_lock_irq(&btnc->tree_lock); | 282 | spin_lock_irq(&btnc->tree_lock); |
| 283 | radix_tree_delete(&btnc->page_tree, oldkey); | 283 | radix_tree_delete(&btnc->page_tree, oldkey); |
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index 1c6cfb59128d..3f5d5d06f53c 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c | |||
| @@ -871,7 +871,6 @@ int nilfs_cpfile_change_cpmode(struct inode *cpfile, __u64 cno, int mode) | |||
| 871 | * exclusive with a new mount job. Though it doesn't cover | 871 | * exclusive with a new mount job. Though it doesn't cover |
| 872 | * umount, it's enough for the purpose. | 872 | * umount, it's enough for the purpose. |
| 873 | */ | 873 | */ |
| 874 | mutex_lock(&nilfs->ns_mount_mutex); | ||
| 875 | if (nilfs_checkpoint_is_mounted(nilfs, cno, 1)) { | 874 | if (nilfs_checkpoint_is_mounted(nilfs, cno, 1)) { |
| 876 | /* Current implementation does not have to protect | 875 | /* Current implementation does not have to protect |
| 877 | plain read-only mounts since they are exclusive | 876 | plain read-only mounts since they are exclusive |
| @@ -880,7 +879,6 @@ int nilfs_cpfile_change_cpmode(struct inode *cpfile, __u64 cno, int mode) | |||
| 880 | ret = -EBUSY; | 879 | ret = -EBUSY; |
| 881 | } else | 880 | } else |
| 882 | ret = nilfs_cpfile_clear_snapshot(cpfile, cno); | 881 | ret = nilfs_cpfile_clear_snapshot(cpfile, cno); |
| 883 | mutex_unlock(&nilfs->ns_mount_mutex); | ||
| 884 | return ret; | 882 | return ret; |
| 885 | case NILFS_SNAPSHOT: | 883 | case NILFS_SNAPSHOT: |
| 886 | return nilfs_cpfile_set_snapshot(cpfile, cno); | 884 | return nilfs_cpfile_set_snapshot(cpfile, cno); |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 5040220c3732..2a0a5a3ac134 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
| @@ -664,7 +664,6 @@ int nilfs_load_inode_block(struct nilfs_sb_info *sbi, struct inode *inode, | |||
| 664 | int err; | 664 | int err; |
| 665 | 665 | ||
| 666 | spin_lock(&sbi->s_inode_lock); | 666 | spin_lock(&sbi->s_inode_lock); |
| 667 | /* Caller of this function MUST lock s_inode_lock */ | ||
| 668 | if (ii->i_bh == NULL) { | 667 | if (ii->i_bh == NULL) { |
| 669 | spin_unlock(&sbi->s_inode_lock); | 668 | spin_unlock(&sbi->s_inode_lock); |
| 670 | err = nilfs_ifile_get_inode_block(sbi->s_ifile, inode->i_ino, | 669 | err = nilfs_ifile_get_inode_block(sbi->s_ifile, inode->i_ino, |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 6572ea4bc4df..f6af76042d80 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
| @@ -99,7 +99,8 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs, | |||
| 99 | static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, | 99 | static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, |
| 100 | unsigned int cmd, void __user *argp) | 100 | unsigned int cmd, void __user *argp) |
| 101 | { | 101 | { |
| 102 | struct inode *cpfile = NILFS_SB(inode->i_sb)->s_nilfs->ns_cpfile; | 102 | struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs; |
| 103 | struct inode *cpfile = nilfs->ns_cpfile; | ||
| 103 | struct nilfs_transaction_info ti; | 104 | struct nilfs_transaction_info ti; |
| 104 | struct nilfs_cpmode cpmode; | 105 | struct nilfs_cpmode cpmode; |
| 105 | int ret; | 106 | int ret; |
| @@ -109,14 +110,17 @@ static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, | |||
| 109 | if (copy_from_user(&cpmode, argp, sizeof(cpmode))) | 110 | if (copy_from_user(&cpmode, argp, sizeof(cpmode))) |
| 110 | return -EFAULT; | 111 | return -EFAULT; |
| 111 | 112 | ||
| 113 | mutex_lock(&nilfs->ns_mount_mutex); | ||
| 112 | nilfs_transaction_begin(inode->i_sb, &ti, 0); | 114 | nilfs_transaction_begin(inode->i_sb, &ti, 0); |
| 113 | ret = nilfs_cpfile_change_cpmode( | 115 | ret = nilfs_cpfile_change_cpmode( |
| 114 | cpfile, cpmode.cm_cno, cpmode.cm_mode); | 116 | cpfile, cpmode.cm_cno, cpmode.cm_mode); |
| 115 | if (unlikely(ret < 0)) { | 117 | if (unlikely(ret < 0)) { |
| 116 | nilfs_transaction_abort(inode->i_sb); | 118 | nilfs_transaction_abort(inode->i_sb); |
| 119 | mutex_unlock(&nilfs->ns_mount_mutex); | ||
| 117 | return ret; | 120 | return ret; |
| 118 | } | 121 | } |
| 119 | nilfs_transaction_commit(inode->i_sb); /* never fails */ | 122 | nilfs_transaction_commit(inode->i_sb); /* never fails */ |
| 123 | mutex_unlock(&nilfs->ns_mount_mutex); | ||
| 120 | return ret; | 124 | return ret; |
| 121 | } | 125 | } |
| 122 | 126 | ||
| @@ -297,7 +301,18 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode, | |||
| 297 | (unsigned long long)vdesc->vd_vblocknr); | 301 | (unsigned long long)vdesc->vd_vblocknr); |
| 298 | return ret; | 302 | return ret; |
| 299 | } | 303 | } |
| 300 | bh->b_private = vdesc; | 304 | if (unlikely(!list_empty(&bh->b_assoc_buffers))) { |
| 305 | printk(KERN_CRIT "%s: conflicting %s buffer: ino=%llu, " | ||
| 306 | "cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu\n", | ||
| 307 | __func__, vdesc->vd_flags ? "node" : "data", | ||
| 308 | (unsigned long long)vdesc->vd_ino, | ||
| 309 | (unsigned long long)vdesc->vd_cno, | ||
| 310 | (unsigned long long)vdesc->vd_offset, | ||
| 311 | (unsigned long long)vdesc->vd_blocknr, | ||
| 312 | (unsigned long long)vdesc->vd_vblocknr); | ||
| 313 | brelse(bh); | ||
| 314 | return -EEXIST; | ||
| 315 | } | ||
| 301 | list_add_tail(&bh->b_assoc_buffers, buffers); | 316 | list_add_tail(&bh->b_assoc_buffers, buffers); |
| 302 | return 0; | 317 | return 0; |
| 303 | } | 318 | } |
| @@ -335,24 +350,10 @@ static int nilfs_ioctl_move_blocks(struct the_nilfs *nilfs, | |||
| 335 | list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) { | 350 | list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) { |
| 336 | ret = nilfs_gccache_wait_and_mark_dirty(bh); | 351 | ret = nilfs_gccache_wait_and_mark_dirty(bh); |
| 337 | if (unlikely(ret < 0)) { | 352 | if (unlikely(ret < 0)) { |
| 338 | if (ret == -EEXIST) { | 353 | WARN_ON(ret == -EEXIST); |
| 339 | vdesc = bh->b_private; | ||
| 340 | printk(KERN_CRIT | ||
| 341 | "%s: conflicting %s buffer: " | ||
| 342 | "ino=%llu, cno=%llu, offset=%llu, " | ||
| 343 | "blocknr=%llu, vblocknr=%llu\n", | ||
| 344 | __func__, | ||
| 345 | vdesc->vd_flags ? "node" : "data", | ||
| 346 | (unsigned long long)vdesc->vd_ino, | ||
| 347 | (unsigned long long)vdesc->vd_cno, | ||
| 348 | (unsigned long long)vdesc->vd_offset, | ||
| 349 | (unsigned long long)vdesc->vd_blocknr, | ||
| 350 | (unsigned long long)vdesc->vd_vblocknr); | ||
| 351 | } | ||
| 352 | goto failed; | 354 | goto failed; |
| 353 | } | 355 | } |
| 354 | list_del_init(&bh->b_assoc_buffers); | 356 | list_del_init(&bh->b_assoc_buffers); |
| 355 | bh->b_private = NULL; | ||
| 356 | brelse(bh); | 357 | brelse(bh); |
| 357 | } | 358 | } |
| 358 | return nmembs; | 359 | return nmembs; |
| @@ -360,7 +361,6 @@ static int nilfs_ioctl_move_blocks(struct the_nilfs *nilfs, | |||
| 360 | failed: | 361 | failed: |
| 361 | list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) { | 362 | list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) { |
| 362 | list_del_init(&bh->b_assoc_buffers); | 363 | list_del_init(&bh->b_assoc_buffers); |
| 363 | bh->b_private = NULL; | ||
| 364 | brelse(bh); | 364 | brelse(bh); |
| 365 | } | 365 | } |
| 366 | return ret; | 366 | return ret; |
| @@ -471,7 +471,6 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs, | |||
| 471 | return 0; | 471 | return 0; |
| 472 | 472 | ||
| 473 | failed: | 473 | failed: |
| 474 | nilfs_remove_all_gcinode(nilfs); | ||
| 475 | printk(KERN_ERR "NILFS: GC failed during preparation: %s: err=%d\n", | 474 | printk(KERN_ERR "NILFS: GC failed during preparation: %s: err=%d\n", |
| 476 | msg, ret); | 475 | msg, ret); |
| 477 | return ret; | 476 | return ret; |
| @@ -560,6 +559,8 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, | |||
| 560 | else | 559 | else |
| 561 | ret = nilfs_clean_segments(inode->i_sb, argv, kbufs); | 560 | ret = nilfs_clean_segments(inode->i_sb, argv, kbufs); |
| 562 | 561 | ||
| 562 | if (ret < 0) | ||
| 563 | nilfs_remove_all_gcinode(nilfs); | ||
| 563 | clear_nilfs_gc_running(nilfs); | 564 | clear_nilfs_gc_running(nilfs); |
| 564 | 565 | ||
| 565 | out_free: | 566 | out_free: |
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 683df89dbae5..6eff66a070d5 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
| @@ -2468,17 +2468,22 @@ static void nilfs_segctor_notify(struct nilfs_sc_info *sci, | |||
| 2468 | /* Clear requests (even when the construction failed) */ | 2468 | /* Clear requests (even when the construction failed) */ |
| 2469 | spin_lock(&sci->sc_state_lock); | 2469 | spin_lock(&sci->sc_state_lock); |
| 2470 | 2470 | ||
| 2471 | sci->sc_state &= ~NILFS_SEGCTOR_COMMIT; | ||
| 2472 | |||
| 2473 | if (req->mode == SC_LSEG_SR) { | 2471 | if (req->mode == SC_LSEG_SR) { |
| 2472 | sci->sc_state &= ~NILFS_SEGCTOR_COMMIT; | ||
| 2474 | sci->sc_seq_done = req->seq_accepted; | 2473 | sci->sc_seq_done = req->seq_accepted; |
| 2475 | nilfs_segctor_wakeup(sci, req->sc_err ? : req->sb_err); | 2474 | nilfs_segctor_wakeup(sci, req->sc_err ? : req->sb_err); |
| 2476 | sci->sc_flush_request = 0; | 2475 | sci->sc_flush_request = 0; |
| 2477 | } else if (req->mode == SC_FLUSH_FILE) | 2476 | } else { |
| 2478 | sci->sc_flush_request &= ~FLUSH_FILE_BIT; | 2477 | if (req->mode == SC_FLUSH_FILE) |
| 2479 | else if (req->mode == SC_FLUSH_DAT) | 2478 | sci->sc_flush_request &= ~FLUSH_FILE_BIT; |
| 2480 | sci->sc_flush_request &= ~FLUSH_DAT_BIT; | 2479 | else if (req->mode == SC_FLUSH_DAT) |
| 2480 | sci->sc_flush_request &= ~FLUSH_DAT_BIT; | ||
| 2481 | 2481 | ||
| 2482 | /* re-enable timer if checkpoint creation was not done */ | ||
| 2483 | if (sci->sc_timer && (sci->sc_state & NILFS_SEGCTOR_COMMIT) && | ||
| 2484 | time_before(jiffies, sci->sc_timer->expires)) | ||
| 2485 | add_timer(sci->sc_timer); | ||
| 2486 | } | ||
| 2482 | spin_unlock(&sci->sc_state_lock); | 2487 | spin_unlock(&sci->sc_state_lock); |
| 2483 | } | 2488 | } |
| 2484 | 2489 | ||
