aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/ioctl.c')
-rw-r--r--fs/nilfs2/ioctl.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 6572ea4bc4df..d24057d58f17 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -297,7 +297,18 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode,
297 (unsigned long long)vdesc->vd_vblocknr); 297 (unsigned long long)vdesc->vd_vblocknr);
298 return ret; 298 return ret;
299 } 299 }
300 bh->b_private = vdesc; 300 if (unlikely(!list_empty(&bh->b_assoc_buffers))) {
301 printk(KERN_CRIT "%s: conflicting %s buffer: ino=%llu, "
302 "cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu\n",
303 __func__, vdesc->vd_flags ? "node" : "data",
304 (unsigned long long)vdesc->vd_ino,
305 (unsigned long long)vdesc->vd_cno,
306 (unsigned long long)vdesc->vd_offset,
307 (unsigned long long)vdesc->vd_blocknr,
308 (unsigned long long)vdesc->vd_vblocknr);
309 brelse(bh);
310 return -EEXIST;
311 }
301 list_add_tail(&bh->b_assoc_buffers, buffers); 312 list_add_tail(&bh->b_assoc_buffers, buffers);
302 return 0; 313 return 0;
303} 314}
@@ -335,24 +346,10 @@ static int nilfs_ioctl_move_blocks(struct the_nilfs *nilfs,
335 list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) { 346 list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) {
336 ret = nilfs_gccache_wait_and_mark_dirty(bh); 347 ret = nilfs_gccache_wait_and_mark_dirty(bh);
337 if (unlikely(ret < 0)) { 348 if (unlikely(ret < 0)) {
338 if (ret == -EEXIST) { 349 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; 350 goto failed;
353 } 351 }
354 list_del_init(&bh->b_assoc_buffers); 352 list_del_init(&bh->b_assoc_buffers);
355 bh->b_private = NULL;
356 brelse(bh); 353 brelse(bh);
357 } 354 }
358 return nmembs; 355 return nmembs;
@@ -360,7 +357,6 @@ static int nilfs_ioctl_move_blocks(struct the_nilfs *nilfs,
360 failed: 357 failed:
361 list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) { 358 list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) {
362 list_del_init(&bh->b_assoc_buffers); 359 list_del_init(&bh->b_assoc_buffers);
363 bh->b_private = NULL;
364 brelse(bh); 360 brelse(bh);
365 } 361 }
366 return ret; 362 return ret;
@@ -471,7 +467,6 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
471 return 0; 467 return 0;
472 468
473 failed: 469 failed:
474 nilfs_remove_all_gcinode(nilfs);
475 printk(KERN_ERR "NILFS: GC failed during preparation: %s: err=%d\n", 470 printk(KERN_ERR "NILFS: GC failed during preparation: %s: err=%d\n",
476 msg, ret); 471 msg, ret);
477 return ret; 472 return ret;
@@ -560,6 +555,8 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
560 else 555 else
561 ret = nilfs_clean_segments(inode->i_sb, argv, kbufs); 556 ret = nilfs_clean_segments(inode->i_sb, argv, kbufs);
562 557
558 if (ret < 0)
559 nilfs_remove_all_gcinode(nilfs);
563 clear_nilfs_gc_running(nilfs); 560 clear_nilfs_gc_running(nilfs);
564 561
565 out_free: 562 out_free: