Commit cad46744 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'fixes' of git://oss.oracle.com/git/tma/linux-2.6

* 'fixes' of git://oss.oracle.com/git/tma/linux-2.6:
  ocfs2: Fix orphan add in ocfs2_create_inode_in_orphan
  ocfs2: split out ocfs2_prepare_orphan_dir() into locking and prep functions
  ocfs2: allow return of new inode block location before allocation of the inode
  ocfs2: use ocfs2_alloc_dinode_update_counts() instead of open coding
  ocfs2: split out inode alloc code from ocfs2_mknod_locked
  Ocfs2: Fix a regression bug from mainline commit(6b933c8e).
  ocfs2: Fix deadlock when allocating page
  ocfs2: properly set and use inode group alloc hint
  ocfs2: Use the right group in nfs sync check.
  ocfs2: Flush drive's caches on fdatasync
  ocfs2: make __ocfs2_page_mkwrite handle file end properly.
  ocfs2: Fix incorrect checksum validation error
  ocfs2: Fix metaecc error messages
parents cc491e27 97b8f4a9
...@@ -6672,7 +6672,7 @@ int ocfs2_grab_pages(struct inode *inode, loff_t start, loff_t end, ...@@ -6672,7 +6672,7 @@ int ocfs2_grab_pages(struct inode *inode, loff_t start, loff_t end,
last_page_bytes = PAGE_ALIGN(end); last_page_bytes = PAGE_ALIGN(end);
index = start >> PAGE_CACHE_SHIFT; index = start >> PAGE_CACHE_SHIFT;
do { do {
pages[numpages] = grab_cache_page(mapping, index); pages[numpages] = find_or_create_page(mapping, index, GFP_NOFS);
if (!pages[numpages]) { if (!pages[numpages]) {
ret = -ENOMEM; ret = -ENOMEM;
mlog_errno(ret); mlog_errno(ret);
......
...@@ -439,7 +439,7 @@ int ocfs2_block_check_validate(void *data, size_t blocksize, ...@@ -439,7 +439,7 @@ int ocfs2_block_check_validate(void *data, size_t blocksize,
ocfs2_blockcheck_inc_failure(stats); ocfs2_blockcheck_inc_failure(stats);
mlog(ML_ERROR, mlog(ML_ERROR,
"CRC32 failed: stored: %u, computed %u. Applying ECC.\n", "CRC32 failed: stored: 0x%x, computed 0x%x. Applying ECC.\n",
(unsigned int)check.bc_crc32e, (unsigned int)crc); (unsigned int)check.bc_crc32e, (unsigned int)crc);
/* Ok, try ECC fixups */ /* Ok, try ECC fixups */
...@@ -453,7 +453,7 @@ int ocfs2_block_check_validate(void *data, size_t blocksize, ...@@ -453,7 +453,7 @@ int ocfs2_block_check_validate(void *data, size_t blocksize,
goto out; goto out;
} }
mlog(ML_ERROR, "Fixed CRC32 failed: stored: %u, computed %u\n", mlog(ML_ERROR, "Fixed CRC32 failed: stored: 0x%x, computed 0x%x\n",
(unsigned int)check.bc_crc32e, (unsigned int)crc); (unsigned int)check.bc_crc32e, (unsigned int)crc);
rc = -EIO; rc = -EIO;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/writeback.h> #include <linux/writeback.h>
#include <linux/falloc.h> #include <linux/falloc.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include <linux/blkdev.h>
#define MLOG_MASK_PREFIX ML_INODE #define MLOG_MASK_PREFIX ML_INODE
#include <cluster/masklog.h> #include <cluster/masklog.h>
...@@ -190,8 +191,16 @@ static int ocfs2_sync_file(struct file *file, int datasync) ...@@ -190,8 +191,16 @@ static int ocfs2_sync_file(struct file *file, int datasync)
if (err) if (err)
goto bail; goto bail;
if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) {
/*
* We still have to flush drive's caches to get data to the
* platter
*/
if (osb->s_mount_opt & OCFS2_MOUNT_BARRIER)
blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL,
NULL, BLKDEV_IFL_WAIT);
goto bail; goto bail;
}
journal = osb->journal->j_journal; journal = osb->journal->j_journal;
err = jbd2_journal_force_commit(journal); err = jbd2_journal_force_commit(journal);
...@@ -774,7 +783,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, ...@@ -774,7 +783,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
BUG_ON(abs_to > (((u64)index + 1) << PAGE_CACHE_SHIFT)); BUG_ON(abs_to > (((u64)index + 1) << PAGE_CACHE_SHIFT));
BUG_ON(abs_from & (inode->i_blkbits - 1)); BUG_ON(abs_from & (inode->i_blkbits - 1));
page = grab_cache_page(mapping, index); page = find_or_create_page(mapping, index, GFP_NOFS);
if (!page) { if (!page) {
ret = -ENOMEM; ret = -ENOMEM;
mlog_errno(ret); mlog_errno(ret);
...@@ -2329,7 +2338,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, ...@@ -2329,7 +2338,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) ||
((file->f_flags & O_DIRECT) && has_refcount)) { ((file->f_flags & O_DIRECT) && !direct_io)) {
ret = filemap_fdatawrite_range(file->f_mapping, pos, ret = filemap_fdatawrite_range(file->f_mapping, pos,
pos + count - 1); pos + count - 1);
if (ret < 0) if (ret < 0)
......
...@@ -488,7 +488,11 @@ static int ocfs2_read_locked_inode(struct inode *inode, ...@@ -488,7 +488,11 @@ static int ocfs2_read_locked_inode(struct inode *inode,
OCFS2_BH_IGNORE_CACHE); OCFS2_BH_IGNORE_CACHE);
} else { } else {
status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh); status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh);
if (!status) /*
* If buffer is in jbd, then its checksum may not have been
* computed as yet.
*/
if (!status && !buffer_jbd(bh))
status = ocfs2_validate_inode_block(osb->sb, bh); status = ocfs2_validate_inode_block(osb->sb, bh);
} }
if (status < 0) { if (status < 0) {
......
...@@ -74,9 +74,11 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh, ...@@ -74,9 +74,11 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
/* /*
* Another node might have truncated while we were waiting on * Another node might have truncated while we were waiting on
* cluster locks. * cluster locks.
* We don't check size == 0 before the shift. This is borrowed
* from do_generic_file_read.
*/ */
last_index = size >> PAGE_CACHE_SHIFT; last_index = (size - 1) >> PAGE_CACHE_SHIFT;
if (page->index > last_index) { if (unlikely(!size || page->index > last_index)) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -107,7 +109,7 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh, ...@@ -107,7 +109,7 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
* because the "write" would invalidate their data. * because the "write" would invalidate their data.
*/ */
if (page->index == last_index) if (page->index == last_index)
len = size & ~PAGE_CACHE_MASK; len = ((size - 1) & ~PAGE_CACHE_MASK) + 1;
ret = ocfs2_write_begin_nolock(mapping, pos, len, 0, &locked_page, ret = ocfs2_write_begin_nolock(mapping, pos, len, 0, &locked_page,
&fsdata, di_bh, page); &fsdata, di_bh, page);
......
This diff is collapsed.
...@@ -2960,7 +2960,7 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle, ...@@ -2960,7 +2960,7 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle,
if (map_end & (PAGE_CACHE_SIZE - 1)) if (map_end & (PAGE_CACHE_SIZE - 1))
to = map_end & (PAGE_CACHE_SIZE - 1); to = map_end & (PAGE_CACHE_SIZE - 1);
page = grab_cache_page(mapping, page_index); page = find_or_create_page(mapping, page_index, GFP_NOFS);
/* /*
* In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page
...@@ -3179,7 +3179,8 @@ static int ocfs2_cow_sync_writeback(struct super_block *sb, ...@@ -3179,7 +3179,8 @@ static int ocfs2_cow_sync_writeback(struct super_block *sb,
if (map_end > end) if (map_end > end)
map_end = end; map_end = end;
page = grab_cache_page(context->inode->i_mapping, page_index); page = find_or_create_page(context->inode->i_mapping,
page_index, GFP_NOFS);
BUG_ON(!page); BUG_ON(!page);
wait_on_page_writeback(page); wait_on_page_writeback(page);
......
This diff is collapsed.
...@@ -56,6 +56,9 @@ struct ocfs2_alloc_context { ...@@ -56,6 +56,9 @@ struct ocfs2_alloc_context {
u64 ac_max_block; /* Highest block number to allocate. 0 is u64 ac_max_block; /* Highest block number to allocate. 0 is
is the same as ~0 - unlimited */ is the same as ~0 - unlimited */
int ac_find_loc_only; /* hack for reflink operation ordering */
struct ocfs2_suballoc_result *ac_find_loc_priv; /* */
struct ocfs2_alloc_reservation *ac_resv; struct ocfs2_alloc_reservation *ac_resv;
}; };
...@@ -197,4 +200,22 @@ int ocfs2_lock_allocators(struct inode *inode, struct ocfs2_extent_tree *et, ...@@ -197,4 +200,22 @@ int ocfs2_lock_allocators(struct inode *inode, struct ocfs2_extent_tree *et,
struct ocfs2_alloc_context **meta_ac); struct ocfs2_alloc_context **meta_ac);
int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res); int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res);
/*
* The following two interfaces are for ocfs2_create_inode_in_orphan().
*/
int ocfs2_find_new_inode_loc(struct inode *dir,
struct buffer_head *parent_fe_bh,
struct ocfs2_alloc_context *ac,
u64 *fe_blkno);
int ocfs2_claim_new_inode_at_loc(handle_t *handle,
struct inode *dir,
struct ocfs2_alloc_context *ac,
u64 *suballoc_loc,
u16 *suballoc_bit,
u64 di_blkno);
#endif /* _CHAINALLOC_H_ */ #endif /* _CHAINALLOC_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment