nilfs2: wait for discard to finish
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Wed, 18 Aug 2010 12:11:11 +0000 (21:11 +0900)
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Wed, 18 Aug 2010 15:11:06 +0000 (00:11 +0900)
nilfs_discard_segment() doesn't wait for completion of discard
requests.  This specifies BLKDEV_IFL_WAIT flag when calling
blkdev_issue_discard() in order to fix the sync failure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Christoph Hellwig <hch@lst.de>
fs/nilfs2/the_nilfs.c

index 6af1c00..4317f17 100644 (file)
@@ -775,6 +775,7 @@ int nilfs_discard_segments(struct the_nilfs *nilfs, __u64 *segnump,
                                                   start * sects_per_block,
                                                   nblocks * sects_per_block,
                                                   GFP_NOFS,
+                                                  BLKDEV_IFL_WAIT |
                                                   BLKDEV_IFL_BARRIER);
                        if (ret < 0)
                                return ret;
@@ -785,7 +786,8 @@ int nilfs_discard_segments(struct the_nilfs *nilfs, __u64 *segnump,
                ret = blkdev_issue_discard(nilfs->ns_bdev,
                                           start * sects_per_block,
                                           nblocks * sects_per_block,
-                                          GFP_NOFS, BLKDEV_IFL_BARRIER);
+                                          GFP_NOFS,
+                                         BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
        return ret;
 }